Closed Bug 256617 Opened 20 years ago Closed 20 years ago

throw statement: eol should not be allowed

Categories

(Core :: JavaScript Engine, defect, P2)

x86
Linux
defect

Tracking

()

VERIFIED FIXED
mozilla1.8alpha4

People

(Reporter: igor, Assigned: brendan)

Details

Attachments

(2 files)

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.
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
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+
Attached patch proposed fix (deleted) — Splinter Review
I reused the syntax error message here; I don't see the need for a more pointed diagnostic. /be
Attachment #157763 - Flags: review?(shaver)
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
fwiw i have no interest in this
Attached file js1_5/Regress/regress-256617.js (deleted) —
Igor, with your permission this will be included in the javascript test library.
js1_5/Regress/regress-256617.js checked in.
Flags: testcase+
verified fixed 1.8.x and trunk.
Status: RESOLVED → VERIFIED
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.

Attachment

General

Created:
Updated:
Size: