Closed Bug 1169853 Opened 7 years ago Closed 7 years ago

export default AssignmentExpression without trailing semicolon wrongly passes parser.

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file)

Reflect.parse("export default a 1")

Returns valid Program, since semicolon after AssignmentExpression is not checked.

http://people.mozilla.org/~jorendorff/es6-draft.html#sec-exports
> ExportDeclaration :
>   ...
>   export default [lookahead ∉ {function, class}] AssignmentExpression[In] ;

https://dxr.mozilla.org/mozilla-central/source/js/src/frontend/Parser.cpp#4520
>          default:
>            tokenStream.ungetToken();
>            kid = assignExpr(InAllowed, YieldIsKeyword);
>            break;

MatchOrInsertSemicolon should be there.
Try is running: https://treeherder.mozilla.org/#/jobs?repo=try&revision=d8475878269b
Assignee: nobody → arai.unmht
Added MatchOrInsertSemicolon after assingExpr for `export default`.
Attachment #8613184 - Flags: review?(shu)
Thanks for fixing this arai.
Attachment #8613184 - Flags: review?(shu) → review+
https://hg.mozilla.org/mozilla-central/rev/ae084da24b51
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.