Closed Bug 920747 Opened 11 years ago Closed 9 years ago

Reflect.parse incorrectly shows let VariableDeclarations as kind = "var"

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 589199

People

(Reporter: anton, Unassigned)

Details

STP:

1. Open Scratchpad, enter "let a = {};"
2. Press Pretty Print
3. let is now var.

This is pretty bad because it will introduce subtle bugs in other people's code.
This is actually a bug with Reflect.parse. If you do Reflect.parse("let x = 10") you'll get a VariableDeclaration AST now with kind "var". Interestingly, it works correctly with "const"...just not let.
Summary: Pretty Print changes let to var → Reflect.parse incorrectly shows let VariableDeclarations as kind = "var"
Component: Developer Tools: Scratchpad → JavaScript Engine
Product: Firefox → Core
OS: Mac OS X → All
Hardware: x86 → All
frontend/Parser.cpp at ll. 3631-3641 seem to be relevant here -> "let" at top-level is converted to "var".
I can confirm that `Reflect.parse("{ let x }")` does the right thing.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.