Closed
Bug 256617
Opened 20 years ago
Closed 20 years ago
throw statement: eol should not be allowed
Categories
(Core :: JavaScript Engine, defect, P2)
Tracking
()
VERIFIED
FIXED
mozilla1.8alpha4
People
(Reporter: igor, Assigned: brendan)
Details
Attachments
(2 files)
(deleted),
patch
|
shaver
:
review+
|
Details | Diff | Splinter Review |
(deleted),
text/plain
|
Details |
According to ECMA 262, section 12.13:
12.13 The throw statement
Syntax
ThrowStatement :
throw [no LineTerminator here] Expression ;
So the following should give syntax error:
throw
1;
SpiderMonkey accepts this effectively ignoring LineTerminator.
For reference: Microsoft JScript enforces this.
Assignee | ||
Comment 1•20 years ago
|
||
Small standards conformance bug, should be fixed along with a few others in the
branches as well as the turnk.
/be
Status: NEW → ASSIGNED
Flags: blocking1.7.3+
Flags: blocking-aviary1.0+
Priority: -- → P2
Summary: throw statement: eol should not be allowed → throw statement: eol should not be allowed
Target Milestone: --- → mozilla1.8alpha4
Assignee | ||
Comment 2•20 years ago
|
||
This should not block 1.7 or aviary, and should only go into 1.8a4 or later.
I'm worried it'll bust something, and the gain is mainly standards purity of
essence. I'll fix on the trunk in a bit.
/be
Flags: blocking1.7.3+
Flags: blocking-aviary1.0+
Assignee | ||
Comment 3•20 years ago
|
||
I reused the syntax error message here; I don't see the need for a more pointed
diagnostic.
/be
Assignee | ||
Updated•20 years ago
|
Attachment #157763 -
Flags: review?(shaver)
Attachment #157763 -
Flags: review?(shaver) → review+
Assignee | ||
Comment 4•20 years ago
|
||
Fixed on trunk. Still don't care about this bug for the branches. Someone pipe
up and make me change my mind, if you care.
/be
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment 6•20 years ago
|
||
Igor, with your permission this will be included in the javascript test
library.
Comment 7•20 years ago
|
||
js1_5/Regress/regress-256617.js checked in.
Updated•19 years ago
|
Flags: testcase+
Comment 9•17 years ago
|
||
Actually I think this is wrong per the spec or at least ambiguous since we do follow 7.9.1 for continue, break, and return.
<http://bclary.com/2004/11/07/#a-7.9.1>
When, as the program is parsed from left to right, a token is encountered that is allowed by some production of the grammar, but the production is a restricted production and the token would be the first token for a terminal or nonterminal immediately following the annotation "[no LineTerminator here]" within the restricted production (and therefore such a token is called a restricted token), and the restricted token is separated from the previous token by at least one LineTerminator, then a semicolon is automatically inserted before the restricted token.
<http://bclary.com/2004/11/07/#a-12.13>
12.13 The throw statement
Syntax
ThrowStatement :
throw [no LineTerminator here] Expression ;
Semantics
The production ThrowStatement : throw [no LineTerminator here] Expression ; is evaluated as:
1. Evaluate Expression.
2. Call GetValue(Result(1)).
3. Return (throw, Result(2), empty).
what say es4?
You need to log in
before you can comment on or make changes to this bug.
Description
•