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:
+2
-2
@@ -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); \
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user