File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
src/main/java/com/annimon/ownlang Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,15 @@ public Value access(Value value) {
4343 return thisMap .get (value );
4444 }
4545
46+ public void set (Value key , Value value ) {
47+ final Value v = thisMap .get (key );
48+ if (v == null ) {
49+ throw new RuntimeException ("Unable to add new field "
50+ + key .asString () + " to class " + className );
51+ }
52+ thisMap .set (key , value );
53+ }
54+
4655 @ Override
4756 public Object raw () {
4857 return null ;
Original file line number Diff line number Diff line change @@ -73,6 +73,10 @@ public Value set(Value value) {
7373 ((MapValue ) container ).set (lastIndex , value );
7474 return value ;
7575
76+ case Types .CLASS :
77+ ((ClassInstanceValue ) container ).set (lastIndex , value );
78+ return value ;
79+
7680 default :
7781 throw new TypeException ("Array or map expected. Got " + container .type ());
7882 }
You can’t perform that action at this time.
0 commit comments