Added String.fromCharCode, "a".code

Added a preprocessor
This commit is contained in:
NeeEoo
2024-04-25 17:23:35 +02:00
parent 6c77566fea
commit fb8f35e2a5
11 changed files with 277 additions and 111 deletions
+6 -1
View File
@@ -158,6 +158,11 @@ class Interp {
variables.set("null", null);
variables.set("true", true);
variables.set("false", false);
#if !NO_FROM_CHAR_CODE_FIX
variables.set("__StringWorkaround__fromCharCode", function(a:Int) { // TODO: make hscript only add this if its used
return String.fromCharCode(a);
});
#end
variables.set("trace", Reflect.makeVarArgs(function(el) {
var inf = posInfos();
var v = el.shift();
@@ -472,7 +477,7 @@ class Interp {
}
}
public inline function error(e:#if hscriptPos ErrorDef #else Error #end, rethrow = false):Dynamic {
public inline function error(e:#if hscriptPos Error.ErrorDef #else Error #end, rethrow = false):Dynamic {
#if hscriptPos var e = new Error(e, curExpr.pmin, curExpr.pmax, curExpr.origin, curExpr.line); #end
if (rethrow) {