@@ -15,7 +15,7 @@ class CustomClassDecl implements IHScriptCustomAccessBehaviour {
1515 public var usings : Array <String >;
1616 public var pkg : Null <Array <String >> = null ;
1717 public var ogInterp : Null <Interp > = null ;
18- public var usePublicVars : Null <Bool > = null ;
18+ public var isInline : Null <Bool > = null ;
1919
2020 public var staticInterp : Interp = new Interp ();
2121
@@ -27,27 +27,26 @@ class CustomClassDecl implements IHScriptCustomAccessBehaviour {
2727
2828 public var __allowSetGet : Bool = true ;
2929
30- public function new (classDecl : Expr . ClassDecl , imports : Map <String , CustomClassImport >, usings : Array <String >, ? pkg : Array <String >, ? ogInterp : Interp , ? usePublicVars : Bool ) {
30+ public function new (classDecl : Expr . ClassDecl , imports : Map <String , CustomClassImport >, usings : Array <String >, ? pkg : Array <String >, ? ogInterp : Interp , ? isInline : Bool ) {
3131 this .classDecl = classDecl ;
3232 this .imports = imports ;
3333 this .usings = usings ;
3434 this .pkg = pkg ;
3535 this .ogInterp = ogInterp ;
36- this .usePublicVars = usePublicVars ;
36+ this .isInline = isInline ;
3737
3838 if (ogInterp != null ) {
3939 staticInterp .importFailedCallback = ogInterp .importFailedCallback ;
4040 staticInterp .errorHandler = ogInterp .errorHandler ;
4141 staticInterp .allowStaticVariables = ogInterp .allowStaticVariables ;
4242 staticInterp .staticVariables = ogInterp .staticVariables ;
4343
44- if (usePublicVars != null && usePublicVars ) {
44+ if (isInline != null && isInline ) {
4545 // uses public variables from the same scope as where the class was defined
46+ staticInterp .variables = ogInterp .variables ;
4647 staticInterp .allowPublicVariables = ogInterp .allowPublicVariables ;
4748 staticInterp .publicVariables = ogInterp .publicVariables ;
4849 }
49-
50- // TODO: use normal variables, not just public
5150 }
5251
5352 cacheImports ();
@@ -64,6 +63,8 @@ class CustomClassDecl implements IHScriptCustomAccessBehaviour {
6463 var importedClass = imp .fullPath ;
6564 var importAlias = imp .as ;
6665
66+ if (this .staticInterp .variables .exists (imp .name )) continue ; // class is already imported
67+
6768 if (Interp .customClassExist (importedClass ) && this .staticInterp .importFailedCallback != null ) {
6869 this .staticInterp .importFailedCallback (importedClass .split (" ." ), importAlias );
6970 continue ;
0 commit comments