Import Redirects
This commit is contained in:
@@ -473,6 +473,21 @@ class Interp {
|
||||
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 {
|
||||
#if hscriptPos
|
||||
curExpr = e;
|
||||
@@ -503,6 +518,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);
|
||||
@@ -519,6 +536,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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user