Skip to content

Commit 06a53b1

Browse files
committed
do not generate member functions with empty names
Closes #202
1 parent fe23b03 commit 06a53b1

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/Scope.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ pub const Root = struct {
289289

290290
const last_index = std.mem.lastIndexOf(u8, func_name, "_");
291291
const last_name = if (last_index) |index| func_name[index + 1 ..] else continue;
292+
if (last_name.len == 0) continue;
292293
var same_count: u32 = 0;
293294
const gop = try member_names.getOrPutValue(gpa, last_name, same_count);
294295
if (gop.found_existing) {

test/cases/translate/detect_member_func.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ int baz(Foo *foo);
88
int libsomething_quux(Foo *foo);
99
int foo1_bar(Foo *foo);
1010
int foo2_bar(Foo *foo);
11+
int foo3_(Foo *foo);
1112

1213
typedef union {
1314
int foo;
@@ -39,6 +40,7 @@ int opa_foo2_bar(OpaFoo *foo);
3940
// pub extern fn libsomething_quux(foo: [*c]Foo) c_int;
4041
// pub extern fn foo1_bar(foo: [*c]Foo) c_int;
4142
// pub extern fn foo2_bar(foo: [*c]Foo) c_int;
43+
// pub extern fn foo3_(foo: [*c]Foo) c_int;
4244
// pub const UFoo = extern union {
4345
// foo: c_int,
4446
// numb: f32,

0 commit comments

Comments
 (0)