custom classes

This commit is contained in:
Yoshman29
2023-04-01 15:02:36 +02:00
parent 75041c1db9
commit c5e3ab1162
2 changed files with 11 additions and 10 deletions
+1
View File
@@ -28,6 +28,7 @@ class CustomClassHandler implements IHScriptCustomConstructor {
var _class = Type.createInstance(cl, args);
_class.__interp = interp;
interp.scriptObject = _class;
var newFunc = interp.variables.get("new");
if(newFunc != null) {
+10 -10
View File
@@ -810,17 +810,17 @@ class Parser {
var t = token();
switch( t ) {
case TId("extends"):
t = token();
if(extend != null) {
unexpected(tk);
} else {
switch (tk) {
case TId(id): extend = id;
default: unexpected(tk);
}
var e = parseType();
switch(e) {
case CTPath(path, params):
if(extend != null) {
error(ECustom('Cannot extend a class twice.'), 0, 0);
}
extend = path.join(".");
trace(extend);
default:
error(ECustom('${Std.string(e)} is not a valid path.'), 0, 0);
}
//case TId("implements"):
// implement.push(t);
default:
push(t);
break;