mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-18 13:49:59 +01:00
Inherit methods from enclosing classes.
Like NewtonScript, the inner classes superclasses take precedence, but if not found there then the enclosing classes are searched. This code is still a bit hacky in some corners, but it's a step in the right direction.
This commit is contained in:
@ -375,6 +375,8 @@ struct sObjClass
|
||||
{
|
||||
Obj obj;
|
||||
ObjClass* superclass;
|
||||
|
||||
ObjClass* enclosingClass;
|
||||
|
||||
// The number of fields needed for an instance of this class, including all
|
||||
// of its superclass fields.
|
||||
@ -615,7 +617,8 @@ ObjClass* wrenNewSingleClass(WrenVM* vm, int numFields, ObjString* name);
|
||||
void wrenBindSuperclass(WrenVM* vm, ObjClass* subclass, ObjClass* superclass);
|
||||
|
||||
// Creates a new class object as well as its associated metaclass.
|
||||
ObjClass* wrenNewClass(WrenVM* vm, ObjClass* superclass, int numFields,
|
||||
ObjClass* wrenNewClass(WrenVM* vm, ObjClass* superclass,
|
||||
ObjClass* enclosingClass, int numFields,
|
||||
ObjString* name);
|
||||
|
||||
void wrenBindMethod(WrenVM* vm, ObjClass* classObj, int symbol, Method method);
|
||||
|
||||
Reference in New Issue
Block a user