File tree Expand file tree Collapse file tree 3 files changed +29
-5
lines changed
Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ var map = new StrMap();
2626map.set("Hello","World");
2727trace(map.get("Hello")); // World
2828```
29- You also can use ` in ` keyword.
3029``` haxe
3130import haxe.ds.StringMap in StrMap;
3231
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ class RuleScriptInterp extends hscript.Interp
66{
77 public var scriptPackage : String = ' ' ;
88
9- public var imports : Array < Dynamic > = [];
10- public var usings : Array < Dynamic > = [];
9+ public var imports : Map < String , Dynamic > = [];
10+ public var usings : Map < String , Dynamic > = [];
1111
1212 override private function resetVariables ()
1313 {
@@ -62,14 +62,19 @@ class RuleScriptInterp extends hscript.Interp
6262 error (ECustom (' Type not found : $path ' ));
6363
6464 if (func != null && t is Class )
65- variables .set (func , Reflect .getProperty (t , func ));
65+ {
66+ var tag : String = alias ?? func ;
67+ imports .set (tag , (variables [tag ] = Reflect .getProperty (t , func )));
68+ }
6669 else
70+ {
6771 variables .set (name , t );
72+ }
6873 }
6974 case EUsing (name ):
7075 var t : Dynamic = Type .resolveClass (name );
7176 if (t != null )
72- usings .push ( t );
77+ usings .set ( name , t );
7378 default :
7479 return super .expr (expr );
7580 }
Original file line number Diff line number Diff line change @@ -71,6 +71,26 @@ class Main
7171 return AliasReflect.getProperty(a,"hello");
7272 ' );
7373
74+ runScript ('
75+ import Reflect.getProperty;
76+
77+ var a = {
78+ "hello":"world"
79+ };
80+
81+ return getProperty(a,"hello");
82+ ' );
83+
84+ runScript ('
85+ import Reflect.getProperty as get;
86+
87+ var a = {
88+ "hello":"world"
89+ };
90+
91+ return get(a,"hello");
92+ ' );
93+
7494 runScript ('
7595 using Reflect;
7696
You can’t perform that action at this time.
0 commit comments