File tree Expand file tree Collapse file tree
test/scripts/haxe/importTest Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -474,6 +474,37 @@ class RuleScriptInterp extends hscript.Interp
474474 return null ;
475475 }
476476
477+ override function set (o : Dynamic , f : String , v : Dynamic ): Dynamic
478+ {
479+ if (o == null )
480+ error (EInvalidAccess (f ));
481+
482+ if (o == this )
483+ {
484+ if (variables .exists (f ))
485+ {
486+ var variable : Dynamic = variables .get (f );
487+ variable is RuleScriptProperty ? cast (variable , RuleScriptProperty ).value = v : variables .set (f , v );
488+ return v ;
489+ }
490+ else
491+ o = superInstance ;
492+ }
493+
494+ if (o is RuleScriptedClass )
495+ {
496+ var cl : RuleScriptedClass = cast (o , RuleScriptedClass );
497+ if (cl .variableExists (f ))
498+ {
499+ var o = cl .getVariable (f );
500+ return o is RuleScriptProperty ? cast (o , RuleScriptProperty ).value = v : cl .setVariable (f , v );
501+ }
502+ }
503+
504+ Reflect .setProperty (o , f , v );
505+ return v ;
506+ }
507+
477508 override function call (o : Dynamic , f : Dynamic , args : Array <Dynamic >): Dynamic
478509 {
479510 if (o == superInstance )
Original file line number Diff line number Diff line change @@ -3,10 +3,23 @@ package importTest;
33import importTest.Script;
44
55class ScriptImportTest{
6+ public var a = 'hello';
7+
68 function main(){
79 trace(Script.helloWorld());
810
911 var scriptedClass = new ScriptedClass(1,'ScriptImportTest');
12+
13+ trace(scriptedClass.variable1);
14+
15+ scriptedClass.variable1 += ' 2';
16+
1017 trace(scriptedClass.variable1);
18+
19+ trace(this.a);
20+
21+ this.a = 'world';
22+
23+ trace(this.a);
1124 }
1225}
You can’t perform that action at this time.
0 commit comments