Skip to content

Commit a95e95a

Browse files
rkirslingljharb
authored andcommitted
Normative: Let all early errors be SyntaxErrors (#1527)
1 parent 3654a4f commit a95e95a

File tree

1 file changed

+9
-21
lines changed

1 file changed

+9
-21
lines changed

spec.html

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12822,10 +12822,7 @@ <h1>Static Semantics: Early Errors</h1>
1282212822
</emu-grammar>
1282312823
<ul>
1282412824
<li>
12825-
It is an early Reference Error if AssignmentTargetType of |LeftHandSideExpression| is ~invalid~.
12826-
</li>
12827-
<li>
12828-
It is an early Syntax Error if AssignmentTargetType of |LeftHandSideExpression| is ~strict~.
12825+
It is an early Syntax Error if AssignmentTargetType of |LeftHandSideExpression| is not ~simple~.
1282912826
</li>
1283012827
</ul>
1283112828

@@ -12836,10 +12833,7 @@ <h1>Static Semantics: Early Errors</h1>
1283612833
</emu-grammar>
1283712834
<ul>
1283812835
<li>
12839-
It is an early Reference Error if AssignmentTargetType of |UnaryExpression| is ~invalid~.
12840-
</li>
12841-
<li>
12842-
It is an early Syntax Error if AssignmentTargetType of |UnaryExpression| is ~strict~.
12836+
It is an early Syntax Error if AssignmentTargetType of |UnaryExpression| is not ~simple~.
1284312837
</li>
1284412838
</ul>
1284512839
</emu-clause>
@@ -14124,19 +14118,13 @@ <h1>Static Semantics: Early Errors</h1>
1412414118
It is a Syntax Error if |LeftHandSideExpression| is either an |ObjectLiteral| or an |ArrayLiteral| and |LeftHandSideExpression| is not covering an |AssignmentPattern|.
1412514119
</li>
1412614120
<li>
14127-
It is an early Reference Error if |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral| and AssignmentTargetType of |LeftHandSideExpression| is ~invalid~.
14128-
</li>
14129-
<li>
14130-
It is an early Syntax Error if |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral| and AssignmentTargetType of |LeftHandSideExpression| is ~strict~.
14121+
It is an early Syntax Error if |LeftHandSideExpression| is neither an |ObjectLiteral| nor an |ArrayLiteral| and AssignmentTargetType of |LeftHandSideExpression| is not ~simple~.
1413114122
</li>
1413214123
</ul>
1413314124
<emu-grammar>AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression</emu-grammar>
1413414125
<ul>
1413514126
<li>
14136-
It is an early Reference Error if AssignmentTargetType of |LeftHandSideExpression| is ~invalid~.
14137-
</li>
14138-
<li>
14139-
It is an early Syntax Error if AssignmentTargetType of |LeftHandSideExpression| is ~strict~.
14127+
It is an early Syntax Error if AssignmentTargetType of |LeftHandSideExpression| is not ~simple~.
1414014128
</li>
1414114129
</ul>
1414214130
</emu-clause>
@@ -21070,7 +21058,7 @@ <h1>ParseScript ( _sourceText_, _realm_, _hostDefined_ )</h1>
2107021058

2107121059
<emu-alg>
2107221060
1. Assert: _sourceText_ is an ECMAScript source text (see clause <emu-xref href="#sec-ecmascript-language-source-code"></emu-xref>).
21073-
1. Parse _sourceText_ using |Script| as the goal symbol and analyse the parse result for any Early Error conditions. If the parse was successful and no early errors were found, let _body_ be the resulting parse tree. Otherwise, let _body_ be a List of one or more *SyntaxError* or *ReferenceError* objects representing the parsing errors and/or early errors. Parsing and early error detection may be interweaved in an implementation-dependent manner. If more than one parsing error or early error is present, the number and ordering of error objects in the list is implementation-dependent, but at least one must be present.
21061+
1. Parse _sourceText_ using |Script| as the goal symbol and analyse the parse result for any Early Error conditions. If the parse was successful and no early errors were found, let _body_ be the resulting parse tree. Otherwise, let _body_ be a List of one or more *SyntaxError* objects representing the parsing errors and/or early errors. Parsing and early error detection may be interweaved in an implementation-dependent manner. If more than one parsing error or early error is present, the number and ordering of error objects in the list is implementation-dependent, but at least one must be present.
2107421062
1. If _body_ is a List of errors, return _body_.
2107521063
1. Return Script Record { [[Realm]]: _realm_, [[Environment]]: *undefined*, [[ECMAScriptCode]]: _body_, [[HostDefined]]: _hostDefined_ }.
2107621064
</emu-alg>
@@ -22414,7 +22402,7 @@ <h1>ParseModule ( _sourceText_, _realm_, _hostDefined_ )</h1>
2241422402
<p>The abstract operation ParseModule with arguments _sourceText_, _realm_, and _hostDefined_ creates a Source Text Module Record based upon the result of parsing _sourceText_ as a |Module|. ParseModule performs the following steps:</p>
2241522403
<emu-alg>
2241622404
1. Assert: _sourceText_ is an ECMAScript source text (see clause <emu-xref href="#sec-ecmascript-language-source-code"></emu-xref>).
22417-
1. Parse _sourceText_ using |Module| as the goal symbol and analyse the parse result for any Early Error conditions. If the parse was successful and no early errors were found, let _body_ be the resulting parse tree. Otherwise, let _body_ be a List of one or more *SyntaxError* or *ReferenceError* objects representing the parsing errors and/or early errors. Parsing and early error detection may be interweaved in an implementation-dependent manner. If more than one parsing error or early error is present, the number and ordering of error objects in the list is implementation-dependent, but at least one must be present.
22405+
1. Parse _sourceText_ using |Module| as the goal symbol and analyse the parse result for any Early Error conditions. If the parse was successful and no early errors were found, let _body_ be the resulting parse tree. Otherwise, let _body_ be a List of one or more *SyntaxError* objects representing the parsing errors and/or early errors. Parsing and early error detection may be interweaved in an implementation-dependent manner. If more than one parsing error or early error is present, the number and ordering of error objects in the list is implementation-dependent, but at least one must be present.
2241822406
1. If _body_ is a List of errors, return _body_.
2241922407
1. Let _requestedModules_ be the ModuleRequests of _body_.
2242022408
1. Let _importEntries_ be ImportEntries of _body_.
@@ -23390,7 +23378,7 @@ <h1>HostReportErrors ( _errorList_ )</h1>
2339023378
<p>An implementation of HostReportErrors must complete normally in all cases. The default implementation of HostReportErrors is to unconditionally return an empty normal completion.</p>
2339123379

2339223380
<emu-note>
23393-
<p>_errorList_ will be a List of ECMAScript language values. If the errors are parsing errors or early errors, these will always be *SyntaxError* or *ReferenceError* objects. Runtime errors, however, can be any ECMAScript value.</p>
23381+
<p>_errorList_ will be a List of ECMAScript language values. If the errors are parsing errors or early errors, these will always be *SyntaxError* objects. Runtime errors, however, can be any ECMAScript value.</p>
2339423382
</emu-note>
2339523383
</emu-clause>
2339623384

@@ -23523,7 +23511,7 @@ <h1>Runtime Semantics: PerformEval ( _x_, _callerRealm_, _strictCaller_, _direct
2352323511
1. Let _inMethod_ be *false*.
2352423512
1. Let _inDerivedConstructor_ be *false*.
2352523513
1. Perform the following substeps in an implementation-dependent order, possibly interleaving parsing and error detection:
23526-
1. Let _script_ be the ECMAScript code that is the result of parsing _x_, interpreted as UTF-16 encoded Unicode text as described in <emu-xref href="#sec-ecmascript-language-types-string-type"></emu-xref>, for the goal symbol |Script|. If the parse fails, throw a *SyntaxError* exception. If any early errors are detected, throw a *SyntaxError* or a *ReferenceError* exception, depending on the type of the error (but see also clause <emu-xref href="#sec-error-handling-and-language-extensions"></emu-xref>).
23514+
1. Let _script_ be the ECMAScript code that is the result of parsing _x_, interpreted as UTF-16 encoded Unicode text as described in <emu-xref href="#sec-ecmascript-language-types-string-type"></emu-xref>, for the goal symbol |Script|. If the parse fails, throw a *SyntaxError* exception. If any early errors are detected, throw a *SyntaxError* exception (but see also clause <emu-xref href="#sec-error-handling-and-language-extensions"></emu-xref>).
2352723515
1. If _script_ Contains |ScriptBody| is *false*, return *undefined*.
2352823516
1. Let _body_ be the |ScriptBody| of _script_.
2352923517
1. If _inFunction_ is *false*, and _body_ Contains |NewTarget|, throw a *SyntaxError* exception.
@@ -24820,7 +24808,7 @@ <h1>Runtime Semantics: CreateDynamicFunction ( _constructor_, _newTarget_, _kind
2482024808
1. Let _parameters_ be the result of parsing _P_, interpreted as UTF-16 encoded Unicode text as described in <emu-xref href="#sec-ecmascript-language-types-string-type"></emu-xref>, using _parameterGoal_ as the goal symbol. Throw a *SyntaxError* exception if the parse fails.
2482124809
1. Let _body_ be the result of parsing _bodyText_, interpreted as UTF-16 encoded Unicode text as described in <emu-xref href="#sec-ecmascript-language-types-string-type"></emu-xref>, using _goal_ as the goal symbol. Throw a *SyntaxError* exception if the parse fails.
2482224810
1. Let _strict_ be ContainsUseStrict of _body_.
24823-
1. If any static semantics errors are detected for _parameters_ or _body_, throw a *SyntaxError* or a *ReferenceError* exception, depending on the type of the error. If _strict_ is *true*, the Early Error rules for <emu-grammar>UniqueFormalParameters : FormalParameters</emu-grammar> are applied.
24811+
1. If any static semantics errors are detected for _parameters_ or _body_, throw a *SyntaxError* exception. If _strict_ is *true*, the Early Error rules for <emu-grammar>UniqueFormalParameters : FormalParameters</emu-grammar> are applied.
2482424812
1. If _strict_ is *true* and IsSimpleParameterList of _parameters_ is *false*, throw a *SyntaxError* exception.
2482524813
1. If any element of the BoundNames of _parameters_ also occurs in the LexicallyDeclaredNames of _body_, throw a *SyntaxError* exception.
2482624814
1. If _body_ Contains |SuperCall| is *true*, throw a *SyntaxError* exception.

0 commit comments

Comments
 (0)