WIP Classes

This commit is contained in:
NeeEoo
2023-03-31 20:16:30 +02:00
parent 5684ca8671
commit b7b12b6cbb
2 changed files with 21 additions and 1 deletions
+20 -1
View File
@@ -449,6 +449,9 @@ class Interp {
case EClass(name, fields, extend, interfaces):
trace(fields);
//trace(Printer.toString(fields));
for(field in fields) {
trace(Printer.toString(field));
}
case EImport(c):
if (!importEnabled)
return null;
@@ -961,9 +964,25 @@ class Interp {
}
function cnew(cl:String, args:Array<Dynamic>):Dynamic {
var cl:String = cast cl;
var c = Type.resolveClass(cl);
if (c == null)
if (c == null) {
c = resolve(cl);
//if ((c is TemplateClassGenerator)) {
// return Reflect.callMethod(c, c._hnew, args);
//}
}
return Type.createInstance(c, args);
}
}
class TemplateClass {
}
class TemplateClassGenerator {
function _hnew() {
}
}
+1
View File
@@ -277,6 +277,7 @@ class Parser {
return switch( expr(e) ) {
case EBlock(_), EObject(_), ESwitch(_): true;
case EFunction(_,e,_,_,_,_): isBlock(e);
case EClass(_,e,_,_): true;
case EVar(_, t, e, _,_): e != null ? isBlock(e) : t != null ? t.match(CTAnon(_)) : false;
case EIf(_,e1,e2): if( e2 != null ) isBlock(e2) else isBlock(e1);
case EBinop(_,_,e): isBlock(e);