-
-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Description
The compiler should generate a class function for Xbase++ Classes.
CLASS Foo
ENDCLASS
FUNCTION Foo() AS ClassObjectHelper<Foo>
RETURN ClassObjectHelper<Foo>{}
CLASS ClassObjectHelper<T>
METHOD New(_args params USUAL[]) AS T
RETURN (T) _createInstance(typeof(T):FullName, _args)
METHOD NoIvarGet(cName AS STRING) AS USUAL
// Lookup static field cName and return its value
RETURN NIL
METHOD NoIvarPut(cName as string, uValue as usual) as void
// Lookup static field cName and set its value
RETURN
METHOD NoMethod(_args params USUAL[]) as USUAL
// Lookup class method and call it.
RETURN "NoMethod"
END CLASS
This would allow code like this:
oFoo := Foo():New()
? Foo():ClassVar
? Foo():ClassVar := 42
? Foo():ClassMethod()
The current special compiler code that mapsFoo():New()to Foo{} can then be removed
The ClassObjectHelper class should be part of the runtime