Open
Bug 1146031
Opened 10 years ago
Updated 2 years ago
Reflect.parse sets "id" property on FunctionExpression for methods
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
NEW
People
(Reporter: billm, Unassigned)
Details
When I run this code:
Reflect.parse("x = { method() {} }")
I get a FunctionExpression whose "id" property is set:
value:{loc:{start:{line:1, column:6}, end:{line:1, column:17}, source:null}, type:"FunctionExpression", id:{loc:null, type:"Identifier", name:"method"}, params:[], defaults:[], body:{loc:{start:{line:1, column:15}, end:{line:1, column:16}, source:null}, type:"BlockStatement", body:[]}, rest:null, generator:false, expression:false}
This is bad because it means there's basically no way to distinguish the code above from:
Reflect.parse("x = { method: function method() {} }")
In the latter one, method is bound inside the method body. In the former, it's not.
When I parse the former code using Esprima, it correctly sets the "id" property on the FunctionExpression to null.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•