export default AssignmentExpression without trailing semicolon wrongly passes parser.

RESOLVED FIXED in Firefox 41

Status

()

RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: arai, Assigned: arai)

Tracking

Trunk
mozilla41
Points:
---

Firefox Tracking Flags

(firefox41 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
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.
(Assignee)

Comment 1

3 years ago
Try is running: https://treeherder.mozilla.org/#/jobs?repo=try&revision=d8475878269b
Assignee: nobody → arai.unmht
(Assignee)

Comment 2

3 years ago
Created attachment 8613184 [details] [diff] [review]
Require semicolon after export default AssignmentExpression.

Added MatchOrInsertSemicolon after assingExpr for `export default`.
Attachment #8613184 - Flags: review?(shu)
Thanks for fixing this arai.

Updated

3 years ago
Attachment #8613184 - Flags: review?(shu) → review+
https://hg.mozilla.org/mozilla-central/rev/ae084da24b51
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox41: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.