Skip to content

Commit 38f2cea

Browse files
committed
Merge pull request #282 from usev6/iter_ContextRef
Set values for iter for ContextRef
2 parents 6a6766d + aa60267 commit 38f2cea

File tree

1 file changed

+17
-10
lines changed
  • src/vm/jvm/runtime/org/perl6/nqp/runtime

1 file changed

+17
-10
lines changed

src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3613,25 +3613,32 @@ else if (agg.st.REPR instanceof ContextRef) {
36133613
SixModelObject BOOTHash = tc.gc.BOOTHash;
36143614
SixModelObject hash = BOOTHash.st.REPR.allocate(tc, BOOTHash.st);
36153615

3616-
/* TODO: don't cheat and just shove the nulls in. It's enough for
3617-
* the initial use case of this, though.
3618-
*/
36193616
StaticCodeInfo sci = ((ContextRefInstance)agg).context.codeRef.staticInfo;
36203617
if (sci.oLexicalNames != null) {
36213618
for (int i = 0; i < sci.oLexicalNames.length; i++)
3622-
hash.bind_key_boxed(tc, sci.oLexicalNames[i], null);
3619+
hash.bind_key_boxed(tc, sci.oLexicalNames[i],
3620+
((ContextRefInstance)agg).at_key_boxed(tc, sci.oLexicalNames[i]));
36233621
}
36243622
if (sci.iLexicalNames != null) {
3625-
for (int i = 0; i < sci.iLexicalNames.length; i++)
3626-
hash.bind_key_boxed(tc, sci.iLexicalNames[i], null);
3623+
for (int i = 0; i < sci.iLexicalNames.length; i++) {
3624+
((ContextRefInstance)agg).at_key_boxed(tc, sci.iLexicalNames[i]);
3625+
hash.bind_key_boxed(tc, sci.iLexicalNames[i],
3626+
box_i(tc.native_i, ((ContextRefInstance)agg).context.codeRef.staticInfo.compUnit.hllConfig.intBoxType, tc));
3627+
}
36273628
}
36283629
if (sci.nLexicalNames != null) {
3629-
for (int i = 0; i < sci.nLexicalNames.length; i++)
3630-
hash.bind_key_boxed(tc, sci.nLexicalNames[i], null);
3630+
for (int i = 0; i < sci.nLexicalNames.length; i++) {
3631+
((ContextRefInstance)agg).at_key_boxed(tc, sci.nLexicalNames[i]);
3632+
hash.bind_key_boxed(tc, sci.nLexicalNames[i],
3633+
box_n(tc.native_n, ((ContextRefInstance)agg).context.codeRef.staticInfo.compUnit.hllConfig.numBoxType, tc));
3634+
}
36313635
}
36323636
if (sci.sLexicalNames != null) {
3633-
for (int i = 0; i < sci.sLexicalNames.length; i++)
3634-
hash.bind_key_boxed(tc, sci.sLexicalNames[i], null);
3637+
for (int i = 0; i < sci.sLexicalNames.length; i++) {
3638+
((ContextRefInstance)agg).at_key_boxed(tc, sci.sLexicalNames[i]);
3639+
hash.bind_key_boxed(tc, sci.sLexicalNames[i],
3640+
box_s(tc.native_s, ((ContextRefInstance)agg).context.codeRef.staticInfo.compUnit.hllConfig.strBoxType, tc));
3641+
}
36353642
}
36363643

36373644
return iter(hash, tc);

0 commit comments

Comments
 (0)