fix: name anonymous union in Method struct to comply with strict C99

The anonymous union inside the Method struct was previously unnamed, which is not allowed in strict C99 mode. This change names the union `fn` and updates all references to its members (`.primitive`, `.foreign`, `.obj`) to use the qualified syntax (`.fn.primitive`, `.fn.foreign`, `.fn.obj`). The NATIVE macro parameter was also renamed from `fn` to `function` to avoid shadowing the new union field name.
This commit is contained in:
Bob Nystrom
2015-01-03 04:17:10 +00:00
parent 2d7b4f951c
commit 1663d4d95c
4 changed files with 13 additions and 13 deletions
+2 -2
View File
@@ -8,13 +8,13 @@
// Binds a native method named [name] (in Wren) implemented using C function
// [fn] to `ObjClass` [cls].
#define NATIVE(cls, name, fn) \
#define NATIVE(cls, name, function) \
{ \
int symbol = wrenSymbolTableEnsure(vm, \
&vm->methodNames, name, strlen(name)); \
Method method; \
method.type = METHOD_PRIMITIVE; \
method.primitive = native_##fn; \
method.fn.primitive = native_##function; \
wrenBindMethod(vm, cls, symbol, method); \
}