Merge branch 'master' into codename-dev

This commit is contained in:
Ne_Eo
2024-11-15 15:25:22 +01:00
2 changed files with 27 additions and 3 deletions
+19
View File
@@ -575,6 +575,21 @@ class Interp {
return null;
}
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 {
#if hscriptPos
curExpr = e;
@@ -605,6 +620,8 @@ class Interp {
if (variables.exists(toSetName)) // class is already imported
return null;
var realClassName = getLocalImportRedirect(realClassName);
if (importBlocklist.contains(realClassName))
return null;
var cl = Type.resolveClass(realClassName);
@@ -621,6 +638,8 @@ class Interp {
splitClassName.splice(-2, 1); // Remove the last last item
realClassName = splitClassName.join(".");
var realClassName = getLocalImportRedirect(realClassName);
if (importBlocklist.contains(realClassName))
return null;
+8 -3
View File
@@ -2080,9 +2080,14 @@ class Parser {
var pos = readPos;
while( true ) {
var tk = token();
// TODO: Fix ending in with #end in the file
if( tk == TEof )
error(EInvalidPreprocessor("Unclosed"), pos, pos);
if( tk == TEof ) {
if (preprocStack.length != 0) {
error(EInvalidPreprocessor("Unclosed"), pos, pos);
} else {
break;
}
}
if( preprocStack[spos] != obj ) {
push(tk);
break;