@@ -1043,7 +1043,7 @@ class QAST::OperationsJS {
1043
1043
1044
1044
add_simple_op(' knowhowattr' , $ T_OBJ , [], sub () {" nqp.knowhowattr" });
1045
1045
1046
- add_simple_op(' atkey' , $ T_OBJ , [$ T_OBJ , $ T_STR ], sub ($ hash , $ key ) {" $ hash[ $ key ] " });
1046
+ add_simple_op(' atkey' , $ T_OBJ , [$ T_OBJ , $ T_STR ], sub ($ hash , $ key ) {" $ hash.\$\$atkey( $ key) " });
1047
1047
1048
1048
for <savecapture usecapture > -> $ op {
1049
1049
add_simple_op($ op , $ T_OBJ , [], sub () {
@@ -2158,7 +2158,7 @@ class QAST::CompilerJS does DWIMYNameMangling does SerializeOnce {
2158
2158
} else {
2159
2159
my $ hash := self . as_js($ var [0 ], : want($ T_OBJ ));
2160
2160
my $ key := self . as_js($ var [1 ], : want($ T_STR ));
2161
- Chunk. new ($ T_OBJ , " { $ hash . expr} [ { $ key . expr} ] " , [$ hash , $ key ], : node($ var ));
2161
+ Chunk. new ($ T_OBJ , " { $ hash . expr} .\$\$atkey( { $ key . expr} ) " , [$ hash , $ key ], : node($ var ));
2162
2162
}
2163
2163
} elsif ($ var . scope eq ' attribute' ) {
2164
2164
# TODO take second argument into account
@@ -2189,7 +2189,7 @@ class QAST::CompilerJS does DWIMYNameMangling does SerializeOnce {
2189
2189
my $ key_chunk := self . as_js($ key , : want($ T_STR ));
2190
2190
my $ value_chunk := self . as_js($ value , : want($ T_OBJ ));
2191
2191
2192
- Chunk. new ($ T_OBJ , $ value_chunk . expr, [$ hash_chunk , $ key_chunk , $ value_chunk , " ( { $ hash_chunk . expr} [ { $ key_chunk . expr} ] = { $ value_chunk . expr} );\n " ], : node($ node ));
2192
+ Chunk. new ($ T_OBJ , $ value_chunk . expr, [$ hash_chunk , $ key_chunk , $ value_chunk , " { $ hash_chunk . expr} .\$\$bindkey( { $ key_chunk . expr} , { $ value_chunk . expr} );\n " ], : node($ node ));
2193
2193
}
2194
2194
2195
2195
method bind_pos ($ array , $ index , $ value , : $ node ) {
0 commit comments