diff --git a/hscript/Config.hx b/hscript/Config.hx index 6b51aec..5bf1aba 100644 --- a/hscript/Config.hx +++ b/hscript/Config.hx @@ -21,4 +21,9 @@ class Config { public static final DISALLOW_ABSTRACT_AND_ENUM = [ ]; + + @:unreflective + public static final IMPORT_BLACKLIST:Array = [ + // "flixel.FlxG" + ]; } \ No newline at end of file diff --git a/hscript/Interp.hx b/hscript/Interp.hx index 6730ba0..4d1decc 100644 --- a/hscript/Interp.hx +++ b/hscript/Interp.hx @@ -166,10 +166,10 @@ class Interp { public var allowStaticVariables:Bool = false; public var allowPublicVariables:Bool = false; - // TODO: move this to an external class - public var importBlocklist:Array = [ - // "flixel.FlxG" - ]; + public var importBlocklist(get, never):Array; + private inline function get_importBlocklist():Array { + return Config.IMPORT_BLACKLIST; + } var usingHandler:UsingHandler; @@ -817,7 +817,10 @@ class Interp { function importResolve(__clsName:String):Null { var _realClassName = getLocalImportRedirect(__clsName); - if(importBlocklist.contains(_realClassName)) return null; + if(importBlocklist.contains(_realClassName)) { + warn(ECustom('Invalid class: $_realClassName is blacklisted')); + return null; + } var _cl = Type.resolveClass(_realClassName); if(_cl == null) _cl = Type.resolveClass('${_realClassName}_HSC');