`delete` statement leaves its result on the stack
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 79/100
Research direction
Start with Action::stack_delta in crates/rascal/src/internal/as2_pcode/pcode.rs at the linked lines, then trace how codegen uses the deltas and truncate_stack for expression statements. Check the generated behavior for delete used as a statement against the reproduction in the issue; done when the loop visits a and b once each.
Written by the indexing model from the issue text.
Description
The result of a delete used as a statement is never popped. Inside a for..in loop, the leftover values get enumerated, so the loop doesn't end.
var o = {a: 1, b: 2};
var n = 0;
for (var k in o) {
delete o.nothing;
trace(k);
if (++n == 5) {
trace("too many iterations");
break;
}
}
Expected: a and b, once each.
Actual, in Flash Player (Rascal 0.3.6, SWF 8):
a
false
false
false
false
too many iterations
Assigning the result (var d = delete o.nothing;) works around it.
The cause seems to be the stack deltas in Action::stack_delta:
Both actions push a boolean result, so these should be -1 (pops an object and a name) and 0 (pops a name). The codegen then believes the stack is already balanced, and truncate_stack emits no Pop for the expression statement.
- Dominant language
- Rust
- Stars
- 22
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Dinnerbone/Rascal
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Dinnerbone/Rascal#91 · 2 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Dinnerbone/Rascal#93 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
Dinnerbone/Rascal#88 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Dinnerbone/Rascal#87 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
Dinnerbone/Rascal#76 ·
All issues in Dinnerbone/Rascal
Similar issues
-
yara-x fails to build with rsa 0.10.0: unresolved import rsa::Pkcs1v15SignPossibly taken @CfirTsabari claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 87/100
VirusTotal/yara-x#865 ·
Maintainers usually reply within 1 day
-
good first issue help wanted program
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
hffgzktbcc-blip/ounce-core#297 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nautechsystems/nautilus_trader#5631 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
bytecodealliance/rustix#1736 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
longbridge/gpui-kit#3871 ·
Maintainers usually reply within 1 day