Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49c90e6434 | ||
|
|
bb46d45d56 | ||
|
|
3a5c4f2164 | ||
|
|
f18c7a2210 | ||
|
|
123a7de64a | ||
|
|
e0e1436930 |
@@ -1,2 +1,4 @@
|
|||||||
/hscript.swf
|
/hscript.swf
|
||||||
/release.zip
|
/release.zip
|
||||||
|
|
||||||
|
tests/bin/*
|
||||||
+20
-1
@@ -183,7 +183,7 @@ class Interp {
|
|||||||
assignOp("<<=", function(v1, v2) return v1 << v2);
|
assignOp("<<=", function(v1, v2) return v1 << v2);
|
||||||
assignOp(">>=", function(v1, v2) return v1 >> v2);
|
assignOp(">>=", function(v1, v2) return v1 >> v2);
|
||||||
assignOp(">>>=", function(v1, v2) return v1 >>> v2);
|
assignOp(">>>=", function(v1, v2) return v1 >>> v2);
|
||||||
assignOp("??=", function(v1, v2) return v1 == null ? v2 : v1);
|
assignOp("??" + "=", function(v1, v2) return v1 == null ? v2 : v1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkIsType(e1,e2): Bool {
|
function checkIsType(e1,e2): Bool {
|
||||||
@@ -473,6 +473,21 @@ class Interp {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static var importRedirects:Map<String, String> = new Map();
|
||||||
|
public static function getImportRedirect(className:String):String {
|
||||||
|
return importRedirects.exists(className) ? importRedirects.get(className) : className;
|
||||||
|
}
|
||||||
|
|
||||||
|
public var localImportRedirects:Map<String, String> = new Map();
|
||||||
|
public function getLocalImportRedirect(className:String):String {
|
||||||
|
var className = className;
|
||||||
|
if (importRedirects.exists(className))
|
||||||
|
className = importRedirects.get(className);
|
||||||
|
if (localImportRedirects.exists(className))
|
||||||
|
className = localImportRedirects.get(className);
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
public function expr(e:Expr):Dynamic {
|
public function expr(e:Expr):Dynamic {
|
||||||
#if hscriptPos
|
#if hscriptPos
|
||||||
curExpr = e;
|
curExpr = e;
|
||||||
@@ -503,6 +518,8 @@ class Interp {
|
|||||||
if (variables.exists(toSetName)) // class is already imported
|
if (variables.exists(toSetName)) // class is already imported
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
var realClassName = getLocalImportRedirect(realClassName);
|
||||||
|
|
||||||
if (importBlocklist.contains(realClassName))
|
if (importBlocklist.contains(realClassName))
|
||||||
return null;
|
return null;
|
||||||
var cl = Type.resolveClass(realClassName);
|
var cl = Type.resolveClass(realClassName);
|
||||||
@@ -519,6 +536,8 @@ class Interp {
|
|||||||
splitClassName.splice(-2, 1); // Remove the last last item
|
splitClassName.splice(-2, 1); // Remove the last last item
|
||||||
realClassName = splitClassName.join(".");
|
realClassName = splitClassName.join(".");
|
||||||
|
|
||||||
|
var realClassName = getLocalImportRedirect(realClassName);
|
||||||
|
|
||||||
if (importBlocklist.contains(realClassName))
|
if (importBlocklist.contains(realClassName))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|||||||
+15
-7
@@ -60,10 +60,10 @@ class Parser {
|
|||||||
/**
|
/**
|
||||||
allows to check for #if / #else in code
|
allows to check for #if / #else in code
|
||||||
**/
|
**/
|
||||||
public var preprocesorValues : Map<String,Dynamic> = new Map();
|
public var preprocessorValues : Map<String,Dynamic> = new Map();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
activate JSON compatiblity
|
activate JSON compatibility
|
||||||
**/
|
**/
|
||||||
public var allowJSON : Bool;
|
public var allowJSON : Bool;
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ class Parser {
|
|||||||
["..."],
|
["..."],
|
||||||
["&&"],
|
["&&"],
|
||||||
["||"],
|
["||"],
|
||||||
["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>","??="],
|
["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>","??" + "="],
|
||||||
["->", "??"],
|
["->", "??"],
|
||||||
["is"]
|
["is"]
|
||||||
];
|
];
|
||||||
@@ -1815,7 +1815,7 @@ class Parser {
|
|||||||
case '?'.code:
|
case '?'.code:
|
||||||
var orp = readPos;
|
var orp = readPos;
|
||||||
if (readChar() == '='.code)
|
if (readChar() == '='.code)
|
||||||
return TOp("??=");
|
return TOp("??" + "=");
|
||||||
|
|
||||||
this.readPos = orp;
|
this.readPos = orp;
|
||||||
return TOp("??");
|
return TOp("??");
|
||||||
@@ -2003,9 +2003,14 @@ class Parser {
|
|||||||
var pos = readPos;
|
var pos = readPos;
|
||||||
while( true ) {
|
while( true ) {
|
||||||
var tk = token();
|
var tk = token();
|
||||||
// TODO: Fix ending in with #end in the file
|
|
||||||
if( tk == TEof )
|
if( tk == TEof ) {
|
||||||
error(EInvalidPreprocessor("Unclosed"), pos, pos);
|
if (preprocStack.length != 0) {
|
||||||
|
error(EInvalidPreprocessor("Unclosed"), pos, pos);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if( preprocStack[spos] != obj ) {
|
if( preprocStack[spos] != obj ) {
|
||||||
push(tk);
|
push(tk);
|
||||||
break;
|
break;
|
||||||
@@ -2089,4 +2094,7 @@ class Parser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@:noCompletion public var preprocesorValues(get,set) : Map<String,Dynamic>;
|
||||||
|
inline function get_preprocesorValues() return this.preprocessorValues;
|
||||||
|
inline function set_preprocesorValues(v) return this.preprocessorValues = v;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,12 +144,16 @@ class ClassExtendMacro {
|
|||||||
|
|
||||||
//trace(getModuleName(cl));
|
//trace(getModuleName(cl));
|
||||||
|
|
||||||
|
var hasNew = false;
|
||||||
|
|
||||||
for(_field in [fields.copy(), superFields.copy()])
|
for(_field in [fields.copy(), superFields.copy()])
|
||||||
for(f in _field) {
|
for(f in _field) {
|
||||||
if (f == null)
|
if (f == null)
|
||||||
continue;
|
continue;
|
||||||
if (f.name == "new")
|
if (f.name == "new") {
|
||||||
|
hasNew = true;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
if (f.name.startsWith(FUNC_PREFIX))
|
if (f.name.startsWith(FUNC_PREFIX))
|
||||||
continue;
|
continue;
|
||||||
if (f.access.contains(ADynamic) || f.access.contains(AStatic) || f.access.contains(AExtern) || f.access.contains(AInline))
|
if (f.access.contains(ADynamic) || f.access.contains(AStatic) || f.access.contains(AExtern) || f.access.contains(AInline))
|
||||||
@@ -253,6 +257,13 @@ class ClassExtendMacro {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var totalFields = definedFields.length;
|
||||||
|
|
||||||
|
if(totalFields == 0 && !hasNew) {
|
||||||
|
//Sys.println(cl.pack.join(".") + "." + cl.name + ", " + totalFields);
|
||||||
|
return fields;
|
||||||
|
}
|
||||||
|
|
||||||
shadowClass.kind = TDClass({
|
shadowClass.kind = TDClass({
|
||||||
pack: cl.pack.copy(),
|
pack: cl.pack.copy(),
|
||||||
name: cl.name
|
name: cl.name
|
||||||
@@ -341,7 +352,7 @@ class ClassExtendMacro {
|
|||||||
this.__interp.variables.set(name, val);
|
this.__interp.variables.set(name, val);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
return super.hset(this, name);
|
return super.hset(name, val);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
macro {
|
macro {
|
||||||
|
|||||||
Reference in New Issue
Block a user