Closed
Bug 1023686
Opened 11 years ago
Closed 11 years ago
Parsing non-hoisted vars results in wrong opcode when initializer present
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla33
People
(Reporter: shu, Unassigned)
References
Details
Attachments
(1 file)
|
2.33 KB,
patch
|
luke
:
review+
|
Details | Diff | Splinter Review |
No description provided.
| Reporter | ||
Comment 1•11 years ago
|
||
Attachment #8438120 -
Flags: review?(luke)
Comment 2•11 years ago
|
||
Could you explain this change and also add a testcase that is broken without it?
| Reporter | ||
Comment 3•11 years ago
|
||
(In reply to Luke Wagner [:luke] from comment #2)
> Could you explain this change and also add a testcase that is broken without
> it?
This change is that when parsing non-hoisted lets, we delay define()ing them until the pushLetScope. When that happens, we then go through all the definitions, and define() fixes up their JSOps. This fixing up wasn't taking into account whether the definition node's JSOp was a SET or a GET, and unconditionally changed them to GETs.
As for a testcase, I don't think this code gets exercised currently. I ran into when attempting to remove let expressions and let statements. Currently we desugar
for (let foo = 0;;) stmt
into
let (foo = 0) { for (;;) stmt }
After the removal of let expressions, I was attempting to desugar into
{ let foo = 0; for (;;) stmt }
The for init part is not parsed hoisted, and was getting compiled into something like
zero
getlocal 0
instead of
zero
setlocal 0
Of course the new desugaring is still wrong w.r.t. spec, but that's a separate bug.
Comment 4•11 years ago
|
||
Comment on attachment 8438120 [details] [diff] [review]
Fix JSOP of definition nodes of non-hoisted declarations.
Ah, thanks for explaining.
Attachment #8438120 -
Flags: review?(luke) → review+
Comment 5•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in
before you can comment on or make changes to this bug.
Description
•