WIP Classes
This commit is contained in:
+20
-1
@@ -449,6 +449,9 @@ class Interp {
|
|||||||
case EClass(name, fields, extend, interfaces):
|
case EClass(name, fields, extend, interfaces):
|
||||||
trace(fields);
|
trace(fields);
|
||||||
//trace(Printer.toString(fields));
|
//trace(Printer.toString(fields));
|
||||||
|
for(field in fields) {
|
||||||
|
trace(Printer.toString(field));
|
||||||
|
}
|
||||||
case EImport(c):
|
case EImport(c):
|
||||||
if (!importEnabled)
|
if (!importEnabled)
|
||||||
return null;
|
return null;
|
||||||
@@ -961,9 +964,25 @@ class Interp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cnew(cl:String, args:Array<Dynamic>):Dynamic {
|
function cnew(cl:String, args:Array<Dynamic>):Dynamic {
|
||||||
|
var cl:String = cast cl;
|
||||||
var c = Type.resolveClass(cl);
|
var c = Type.resolveClass(cl);
|
||||||
if (c == null)
|
if (c == null) {
|
||||||
c = resolve(cl);
|
c = resolve(cl);
|
||||||
|
|
||||||
|
//if ((c is TemplateClassGenerator)) {
|
||||||
|
// return Reflect.callMethod(c, c._hnew, args);
|
||||||
|
//}
|
||||||
|
}
|
||||||
return Type.createInstance(c, args);
|
return Type.createInstance(c, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TemplateClass {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class TemplateClassGenerator {
|
||||||
|
function _hnew() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -277,6 +277,7 @@ class Parser {
|
|||||||
return switch( expr(e) ) {
|
return switch( expr(e) ) {
|
||||||
case EBlock(_), EObject(_), ESwitch(_): true;
|
case EBlock(_), EObject(_), ESwitch(_): true;
|
||||||
case EFunction(_,e,_,_,_,_): isBlock(e);
|
case EFunction(_,e,_,_,_,_): isBlock(e);
|
||||||
|
case EClass(_,e,_,_): true;
|
||||||
case EVar(_, t, e, _,_): e != null ? isBlock(e) : t != null ? t.match(CTAnon(_)) : false;
|
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 EIf(_,e1,e2): if( e2 != null ) isBlock(e2) else isBlock(e1);
|
||||||
case EBinop(_,_,e): isBlock(e);
|
case EBinop(_,_,e): isBlock(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user