Skip to content

Commit

Permalink
Editorial: fixes from tc39#1646, tc39#1644, tc39#1406 (tc39#1787)
Browse files Browse the repository at this point in the history
 - insert space before paren in clause heading
 - eliminate grammatical parameters from non-defining production
 - Add 4 <emu-prodref> elements to Annex A
 - tweak syntax in algorithms
 - eliminate accidental ambiguity in Punctuator
      PR tc39#1646 introduced an ambiguity to the lexical grammar:
      Punctuator derives OtherPunctuator in two different ways --
      directly, and indirectly via OptionalChainingPunctuator.

      It doesn't make sense for OptionalChainingPunctuator to derive OtherPunctuator,
      so I've eliminated that alternative.
 - minor grammar refactoring re Punctuator
      Move the Punctuator production back to its former position.
      (Grammars are generally written top-down.)
 - Fix a 'use' production for AsyncConciseBody to match the new defining production
 - Add an <emu-prodref> for ExpressionBody to Annex A
  • Loading branch information
jmdyck authored and ljharb committed Feb 19, 2020
1 parent 31bc4fb commit 97d8f19
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -11100,9 +11100,12 @@ <h2>Syntax</h2>
<h1>Punctuators</h1>
<h2>Syntax</h2>
<emu-grammar type="definition">
Punctuator ::
OptionalChainingPunctuator
OtherPunctuator

OptionalChainingPunctuator ::
`?.` [lookahead &lt;! DecimalDigit]
OtherPunctuator

OtherPunctuator :: one of
`{` `(` `)` `[` `]`
Expand All @@ -11119,10 +11122,6 @@ <h2>Syntax</h2>
`=` `+=` `-=` `*=` `%=` `**=` `&lt;&lt;=` `&gt;&gt;=` `&gt;&gt;&gt;=` `&amp;=` `|=` `^=`
`=&gt;`

Punctuator ::
OptionalChainingPunctuator
OtherPunctuator

DivPunctuator ::
`/`
`/=`
Expand Down Expand Up @@ -13555,9 +13554,9 @@ <h1>Static Semantics</h1>
<emu-clause id="sec-left-hand-side-expressions-static-semantics-early-errors">
<h1>Static Semantics: Early Errors</h1>
<emu-grammar>
OptionalChain[Yield, Await] :
`?.` TemplateLiteral[?Yield, ?Await, +Tagged]
OptionalChain[?Yield, ?Await] TemplateLiteral[?Yield, ?Await, +Tagged]
OptionalChain :
`?.` TemplateLiteral
OptionalChain TemplateLiteral
</emu-grammar>
<ul>
<li>
Expand Down Expand Up @@ -13803,21 +13802,21 @@ <h1>Runtime Semantics: Evaluation</h1>
<emu-alg>
1. Let _baseReference_ be the result of evaluating |CallExpression|.
1. Let _baseValue_ be ? GetValue(_baseReference_).
1. If the code matched by this |CallExpression| is strict mode code, let _strict_ be *true*, else let _strict_ be *false*.
1. If the code matched by this |CallExpression| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*.
1. Return ? EvaluatePropertyAccessWithExpressionKey(_baseValue_, |Expression|, _strict_).
</emu-alg>
<emu-grammar>CallExpression : CallExpression `.` IdentifierName</emu-grammar>
<emu-alg>
1. Let _baseReference_ be the result of evaluating |CallExpression|.
1. Let _baseValue_ be ? GetValue(_baseReference_).
1. If the code matched by this |CallExpression| is strict mode code, let _strict_ be *true*, else let _strict_ be *false*.
1. If the code matched by this |CallExpression| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*.
1. Return ? EvaluatePropertyAccessWithIdentifierKey(_baseValue_, |IdentifierName|, _strict_).
</emu-alg>
</emu-clause>
</emu-clause>

<emu-clause id="sec-evaluate-property-access-with-expression-key" aoid="EvaluatePropertyAccessWithExpressionKey">
<h1>Runtime Semantics: EvaluatePropertyAccessWithExpressionKey( _baseValue_, _expression_, _strict_ )</h1>
<h1>Runtime Semantics: EvaluatePropertyAccessWithExpressionKey ( _baseValue_, _expression_, _strict_ )</h1>
<p>The abstract operation EvaluatePropertyAccessWithExpressionKey takes as arguments a value _baseValue_, a Parse Node _expression_, and a Boolean argument _strict_. It performs the following steps:</p>
<emu-alg>
1. Let _propertyNameReference_ be the result of evaluating _expression_.
Expand All @@ -13828,10 +13827,10 @@ <h1>Runtime Semantics: EvaluatePropertyAccessWithExpressionKey( _baseValue_, _ex
</emu-alg>
</emu-clause>
<emu-clause id="sec-evaluate-property-access-with-identifier-key" aoid="EvaluatePropertyAccessWithIdentifierKey">
<h1>Runtime Semantics: EvaluatePropertyAccessWithIdentifierKey( _baseValue_, _identifierName_, _strict_ )</h1>
<h1>Runtime Semantics: EvaluatePropertyAccessWithIdentifierKey ( _baseValue_, _identifierName_, _strict_ )</h1>
<p>The abstract operation EvaluatePropertyAccessWithIdentifierKey takes as arguments a value _baseValue_, a Parse Node _identifierName_, and a Boolean argument _strict_. It performs the following steps:</p>
<emu-alg>
1. Assert: _identifierName_ is an |IdentifierName|
1. Assert: _identifierName_ is an |IdentifierName|.
1. Let _bv_ be ? RequireObjectCoercible(_baseValue_).
1. Let _propertyNameString_ be StringValue of _identifierName_.
1. Return a value of type Reference whose base value component is _bv_, whose referenced name component is _propertyNameString_, and whose strict reference flag is _strict_.
Expand Down Expand Up @@ -14095,12 +14094,12 @@ <h1>Runtime Semantics: ChainEvaluation</h1>
</emu-alg>
<emu-grammar>OptionalChain : `?.` `[` Expression `]`</emu-grammar>
<emu-alg>
1. If the code matched by this |OptionalChain| is strict mode code, let _strict_ be *true*, else let _strict_ be *false*.
1. If the code matched by this |OptionalChain| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*.
1. Return ? EvaluatePropertyAccessWithExpressionKey(_baseValue_, |Expression|, _strict_).
</emu-alg>
<emu-grammar>OptionalChain : `?.` IdentifierName</emu-grammar>
<emu-alg>
1. If the code matched by this |OptionalChain| is strict mode code, let _strict_ be *true*, else let _strict_ be *false*.
1. If the code matched by this |OptionalChain| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*.
1. Return ? EvaluatePropertyAccessWithIdentifierKey(_baseValue_, |IdentifierName|, _strict_).
</emu-alg>
<emu-grammar>OptionalChain : OptionalChain Arguments</emu-grammar>
Expand All @@ -14117,15 +14116,15 @@ <h1>Runtime Semantics: ChainEvaluation</h1>
1. Let _optionalChain_ be |OptionalChain|.
1. Let _newReference_ be ? ChainEvaluation of _optionalChain_ with arguments _baseValue_ and _baseReference_.
1. Let _newValue_ be ? GetValue(_newReference_).
1. If the code matched by this |OptionalChain| is strict mode code, let _strict_ be *true*, else let _strict_ be *false*.
1. If the code matched by this |OptionalChain| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*.
1. Return ? EvaluatePropertyAccessWithExpressionKey(_newValue_, |Expression|, _strict_).
</emu-alg>
<emu-grammar>OptionalChain : OptionalChain `.` IdentifierName</emu-grammar>
<emu-alg>
1. Let _optionalChain_ be |OptionalChain|.
1. Let _newReference_ be ? ChainEvaluation of _optionalChain_ with arguments _baseValue_ and _baseReference_.
1. Let _newValue_ be ? GetValue(_newReference_).
1. If the code matched by this |OptionalChain| is strict mode code, let _strict_ be *true*, else let _strict_ be *false*.
1. If the code matched by this |OptionalChain| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*.
1. Return ? EvaluatePropertyAccessWithIdentifierKey(_newValue_, |IdentifierName|, _strict_).
</emu-alg>
</emu-clause>
Expand Down Expand Up @@ -15322,7 +15321,7 @@ <h1>Runtime Semantics: Evaluation</h1>
<emu-alg>
1. Let _lref_ be the result of evaluating |CoalesceExpressionHead|.
1. Let _lval_ be ? GetValue(_lref_).
1. If _lval_ is *undefined* or *null*,
1. If _lval_ is *undefined* or *null*, then
1. Let _rref_ be the result of evaluating |BitwiseORExpression|.
1. Return ? GetValue(_rref_).
1. Otherwise, return _lval_.
Expand Down Expand Up @@ -21737,7 +21736,7 @@ <h1>Static Semantics: ContainsExpression</h1>
<emu-clause id="sec-async-arrow-function-definitions-static-semantics-containsusestrict">
<h1>Static Semantics: ContainsUseStrict</h1>
<emu-see-also-para op="ContainsUseStrict"></emu-see-also-para>
<emu-grammar>AsyncConciseBody : AssignmentExpression</emu-grammar>
<emu-grammar>AsyncConciseBody : ExpressionBody</emu-grammar>
<emu-alg>
1. Return *false*.
</emu-alg>
Expand Down Expand Up @@ -41541,6 +41540,8 @@ <h1>Lexical Grammar</h1>
<emu-prodref name=UnicodeIDContinue></emu-prodref>
<emu-prodref name=ReservedWord></emu-prodref>
<emu-prodref name=Punctuator></emu-prodref>
<emu-prodref name=OptionalChainingPunctuator></emu-prodref>
<emu-prodref name=OtherPunctuator></emu-prodref>
<emu-prodref name=DivPunctuator></emu-prodref>
<emu-prodref name=RightBracePunctuator></emu-prodref>
<emu-prodref name=NullLiteral></emu-prodref>
Expand Down Expand Up @@ -41648,6 +41649,8 @@ <h1>Expressions</h1>
<emu-prodref name=ImportCall></emu-prodref>
<emu-prodref name=Arguments></emu-prodref>
<emu-prodref name=ArgumentList></emu-prodref>
<emu-prodref name=OptionalExpression></emu-prodref>
<emu-prodref name=OptionalChain></emu-prodref>
<emu-prodref name=LeftHandSideExpression></emu-prodref>
<emu-prodref name=UpdateExpression></emu-prodref>
<emu-prodref name=UnaryExpression></emu-prodref>
Expand Down Expand Up @@ -41752,6 +41755,7 @@ <h1>Functions and Classes</h1>
<emu-prodref name=ArrowFunction></emu-prodref>
<emu-prodref name=ArrowParameters></emu-prodref>
<emu-prodref name=ConciseBody></emu-prodref>
<emu-prodref name=ExpressionBody></emu-prodref>
<p>When the production <emu-prodref name=ArrowParameters a="parencover"></emu-prodref> is recognized the following grammar is used to refine the interpretation of |CoverParenthesizedExpressionAndArrowParameterList|:</p>
<emu-prodref name=ArrowFormalParameters></emu-prodref>
<p>&nbsp;</p>
Expand Down

0 comments on commit 97d8f19

Please sign in to comment.