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();
26
26
map.set("Hello","World");
27
27
trace(map.get("Hello")); // World
28
28
```
29
- You also can use ` in ` keyword.
30
29
``` haxe
31
30
import haxe.ds.StringMap in StrMap;
32
31
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ class RuleScriptInterp extends hscript.Interp
6
6
{
7
7
public var scriptPackage : String = ' ' ;
8
8
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 > = [];
11
11
12
12
override private function resetVariables ()
13
13
{
@@ -62,14 +62,19 @@ class RuleScriptInterp extends hscript.Interp
62
62
error (ECustom (' Type not found : $path ' ));
63
63
64
64
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
+ }
66
69
else
70
+ {
67
71
variables .set (name , t );
72
+ }
68
73
}
69
74
case EUsing (name ):
70
75
var t : Dynamic = Type .resolveClass (name );
71
76
if (t != null )
72
- usings .push ( t );
77
+ usings .set ( name , t );
73
78
default :
74
79
return super .expr (expr );
75
80
}
Original file line number Diff line number Diff line change @@ -71,6 +71,26 @@ class Main
71
71
return AliasReflect.getProperty(a,"hello");
72
72
' );
73
73
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
+
74
94
runScript ('
75
95
using Reflect;
76
96
You can’t perform that action at this time.
0 commit comments