diff --git a/spec.html b/spec.html index f3f372dde8f..9b1f767e097 100644 --- a/spec.html +++ b/spec.html @@ -9629,7 +9629,7 @@

Static Semantics: AssignmentTargetType ( ): ~simple~ or ~invalid~

IdentifierReference : Identifier - 1. If the source text matched by this |IdentifierReference| is strict mode code and StringValue of |Identifier| is either *"eval"* or *"arguments"*, return ~invalid~. + 1. If IsStrict(this |IdentifierReference|) is *true* and StringValue of |Identifier| is either *"eval"* or *"arguments"*, return ~invalid~. 1. Return ~simple~. @@ -11771,7 +11771,7 @@

1. If _env_ is not present or _env_ is *undefined*, then 1. Set _env_ to the running execution context's LexicalEnvironment. 1. Assert: _env_ is an Environment Record. - 1. If the source text matched by the syntactic production that is being evaluated is strict mode code, let _strict_ be *true*; else let _strict_ be *false*. + 1. If IsStrict(the syntactic production that is being evaluated) is *true*, let _strict_ be *true*; else let _strict_ be *false*. 1. Return ? GetIdentifierReference(_env_, _name_, _strict_). @@ -13407,7 +13407,7 @@

1. Set _F_.[[SourceText]] to _sourceText_. 1. Set _F_.[[FormalParameters]] to _ParameterList_. 1. Set _F_.[[ECMAScriptCode]] to _Body_. - 1. If the source text matched by _Body_ is strict mode code, let _Strict_ be *true*; else let _Strict_ be *false*. + 1. If IsStrict(_Body_) is *true*, let _Strict_ be *true*; else let _Strict_ be *false*. 1. Set _F_.[[Strict]] to _Strict_. 1. If _thisMode_ is ~lexical-this~, set _F_.[[ThisMode]] to ~lexical~. 1. Else if _Strict_ is *true*, set _F_.[[ThisMode]] to ~strict~. @@ -16137,6 +16137,19 @@

Strict Mode Code

ECMAScript code that is not strict mode code is called non-strict code.

+ + +

+ Static Semantics: IsStrict ( + _node_: a Parse Node, + ): a Boolean +

+
+
+ + 1. If the source text matched by _node_ is strict mode code, return *true*; else return *false*. + +
@@ -16870,7 +16883,7 @@

Static Semantics: Early Errors

DecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral
    -
  • It is a Syntax Error if the source text matched by this production is strict mode code.
  • +
  • It is a Syntax Error if IsStrict(this production) is *true*.
In non-strict code, this syntax is Legacy.
@@ -17137,7 +17150,7 @@

Static Semantics: Early Errors

NonOctalDecimalEscapeSequence
    -
  • It is a Syntax Error if the source text matched by this production is strict mode code.
  • +
  • It is a Syntax Error if IsStrict(this production) is *true*.
In non-strict code, this syntax is Legacy. @@ -17994,7 +18007,7 @@

Static Semantics: Early Errors

BindingIdentifier : Identifier
  • - It is a Syntax Error if the source text matched by this production is strict mode code and the StringValue of |Identifier| is either *"arguments"* or *"eval"*. + It is a Syntax Error if IsStrict(this production) is *true* and the StringValue of |Identifier| is either *"arguments"* or *"eval"*.
@@ -18006,7 +18019,7 @@

Static Semantics: Early Errors

  • - It is a Syntax Error if the source text matched by this production is strict mode code. + It is a Syntax Error if IsStrict(this production) is *true*.
@@ -18055,7 +18068,7 @@

Static Semantics: Early Errors

Identifier : IdentifierName but not ReservedWord
  • - It is a Syntax Error if the source text matched by this phrase is strict mode code and the StringValue of |IdentifierName| is one of *"implements"*, *"interface"*, *"let"*, *"package"*, *"private"*, *"protected"*, *"public"*, *"static"*, or *"yield"*. + It is a Syntax Error if IsStrict(this phrase) is *true* and the StringValue of |IdentifierName| is one of *"implements"*, *"interface"*, *"let"*, *"package"*, *"private"*, *"protected"*, *"public"*, *"static"*, or *"yield"*.
  • It is a Syntax Error if the goal symbol of the syntactic grammar is |Module| and the StringValue of |IdentifierName| is *"await"*. @@ -19089,14 +19102,14 @@

    Runtime Semantics: Evaluation

    1. Let _baseReference_ be ? Evaluation of |MemberExpression|. 1. Let _baseValue_ be ? GetValue(_baseReference_). - 1. If the source text matched by this |MemberExpression| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*. + 1. If IsStrict(this |MemberExpression|) is *true*, let _strict_ be *true*; else let _strict_ be *false*. 1. Return ? EvaluatePropertyAccessWithExpressionKey(_baseValue_, |Expression|, _strict_). MemberExpression : MemberExpression `.` IdentifierName 1. Let _baseReference_ be ? Evaluation of |MemberExpression|. 1. Let _baseValue_ be ? GetValue(_baseReference_). - 1. If the source text matched by this |MemberExpression| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*. + 1. If IsStrict(this |MemberExpression|) is *true*, let _strict_ be *true*; else let _strict_ be *false*. 1. Return EvaluatePropertyAccessWithIdentifierKey(_baseValue_, |IdentifierName|, _strict_). MemberExpression : MemberExpression `.` PrivateIdentifier @@ -19110,14 +19123,14 @@

    Runtime Semantics: Evaluation

    1. Let _baseReference_ be ? Evaluation of |CallExpression|. 1. Let _baseValue_ be ? GetValue(_baseReference_). - 1. If the source text matched by this |CallExpression| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*. + 1. If IsStrict(this |CallExpression|) is *true*, let _strict_ be *true*; else let _strict_ be *false*. 1. Return ? EvaluatePropertyAccessWithExpressionKey(_baseValue_, |Expression|, _strict_). CallExpression : CallExpression `.` IdentifierName 1. Let _baseReference_ be ? Evaluation of |CallExpression|. 1. Let _baseValue_ be ? GetValue(_baseReference_). - 1. If the source text matched by this |CallExpression| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*. + 1. If IsStrict(this |CallExpression|) is *true*, let _strict_ be *true*; else let _strict_ be *false*. 1. Return EvaluatePropertyAccessWithIdentifierKey(_baseValue_, |IdentifierName|, _strict_). CallExpression : CallExpression `.` PrivateIdentifier @@ -19218,7 +19231,7 @@

    Runtime Semantics: Evaluation

    1. Let _argList_ be ? ArgumentListEvaluation of _arguments_. 1. If _argList_ has no elements, return *undefined*. 1. Let _evalArg_ be the first element of _argList_. - 1. If the source text matched by this |CallExpression| is strict mode code, let _strictCaller_ be *true*. Otherwise let _strictCaller_ be *false*. + 1. If IsStrict(this |CallExpression|) is *true*, let _strictCaller_ be *true*. Otherwise let _strictCaller_ be *false*. 1. [id="step-callexpression-evaluation-direct-eval"] Return ? PerformEval(_evalArg_, _strictCaller_, *true*). 1. Let _thisCall_ be this |CallExpression|. 1. Let _tailCall_ be IsInTailPosition(_thisCall_). @@ -19277,7 +19290,7 @@

    Runtime Semantics: Evaluation

    1. Let _propertyNameReference_ be ? Evaluation of |Expression|. 1. Let _propertyNameValue_ be ? GetValue(_propertyNameReference_). 1. Let _propertyKey_ be ? ToPropertyKey(_propertyNameValue_). - 1. If the source text matched by this |SuperProperty| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*. + 1. If IsStrict(this |SuperProperty|) is *true*, let _strict_ be *true*; else let _strict_ be *false*. 1. Return ? MakeSuperPropertyReference(_actualThis_, _propertyKey_, _strict_). SuperProperty : `super` `.` IdentifierName @@ -19285,7 +19298,7 @@

    Runtime Semantics: Evaluation

    1. Let _env_ be GetThisEnvironment(). 1. Let _actualThis_ be ? _env_.GetThisBinding(). 1. Let _propertyKey_ be StringValue of |IdentifierName|. - 1. If the source text matched by this |SuperProperty| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*. + 1. If IsStrict(this |SuperProperty|) is *true*, let _strict_ be *true*; else let _strict_ be *false*. 1. Return ? MakeSuperPropertyReference(_actualThis_, _propertyKey_, _strict_). SuperCall : `super` Arguments @@ -19470,12 +19483,12 @@

    OptionalChain : `?.` `[` Expression `]` - 1. If the source text matched by this |OptionalChain| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*. + 1. If IsStrict(this |OptionalChain|) is *true*, let _strict_ be *true*; else let _strict_ be *false*. 1. Return ? EvaluatePropertyAccessWithExpressionKey(_baseValue_, |Expression|, _strict_). OptionalChain : `?.` IdentifierName - 1. If the source text matched by this |OptionalChain| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*. + 1. If IsStrict(this |OptionalChain|) is *true*, let _strict_ be *true*; else let _strict_ be *false*. 1. Return EvaluatePropertyAccessWithIdentifierKey(_baseValue_, |IdentifierName|, _strict_). OptionalChain : `?.` PrivateIdentifier @@ -19497,7 +19510,7 @@

    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 source text matched by this |OptionalChain| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*. + 1. If IsStrict(this |OptionalChain|) is *true*, let _strict_ be *true*; else let _strict_ be *false*. 1. Return ? EvaluatePropertyAccessWithExpressionKey(_newValue_, |Expression|, _strict_). OptionalChain : OptionalChain `.` IdentifierName @@ -19505,7 +19518,7 @@

    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 source text matched by this |OptionalChain| is strict mode code, let _strict_ be *true*; else let _strict_ be *false*. + 1. If IsStrict(this |OptionalChain|) is *true*, let _strict_ be *true*; else let _strict_ be *false*. 1. Return EvaluatePropertyAccessWithIdentifierKey(_newValue_, |IdentifierName|, _strict_). OptionalChain : OptionalChain `.` PrivateIdentifier @@ -19811,7 +19824,7 @@

    Static Semantics: Early Errors

    UnaryExpression : `delete` UnaryExpression
    • - It is a Syntax Error if the source text matched by the |UnaryExpression| is strict mode code and the derived |UnaryExpression| is PrimaryExpression : IdentifierReference, MemberExpression : MemberExpression `.` PrivateIdentifier, CallExpression : CallExpression `.` PrivateIdentifier, OptionalChain : `?.` PrivateIdentifier, or OptionalChain : OptionalChain `.` PrivateIdentifier. + It is a Syntax Error if IsStrict(the |UnaryExpression|) is *true* and the derived |UnaryExpression| is PrimaryExpression : IdentifierReference, MemberExpression : MemberExpression `.` PrivateIdentifier, CallExpression : CallExpression `.` PrivateIdentifier, OptionalChain : `?.` PrivateIdentifier, or OptionalChain : OptionalChain `.` PrivateIdentifier.
    • @@ -22556,7 +22569,7 @@

      Static Semantics: Early Errors

      WithStatement : `with` `(` Expression `)` Statement
      • - It is a Syntax Error if the source text matched by this production is strict mode code. + It is a Syntax Error if IsStrict(this production) is *true*.
      • It is a Syntax Error if IsLabelledFunction(|Statement|) is *true*. @@ -23344,10 +23357,10 @@

        Static Semantics: Early Errors

        • - If the source text matched by |FormalParameters| is strict mode code, the Early Error rules for UniqueFormalParameters : FormalParameters are applied. + If IsStrict(|FormalParameters|) is *true*, the Early Error rules for UniqueFormalParameters : FormalParameters are applied.
        • - If |BindingIdentifier| is present and the source text matched by |BindingIdentifier| is strict mode code, it is a Syntax Error if the StringValue of |BindingIdentifier| is either *"eval"* or *"arguments"*. + If |BindingIdentifier| is present and IsStrict(|BindingIdentifier|) is *true*, it is a Syntax Error if the StringValue of |BindingIdentifier| is either *"eval"* or *"arguments"*.
        • It is a Syntax Error if FunctionBodyContainsUseStrict of |FunctionBody| is *true* and IsSimpleParameterList of |FormalParameters| is *false*. @@ -23913,10 +23926,10 @@

          Static Semantics: Early Errors

          • - If the source text matched by |FormalParameters| is strict mode code, the Early Error rules for UniqueFormalParameters : FormalParameters are applied. + If IsStrict(|FormalParameters|) is *true*, the Early Error rules for UniqueFormalParameters : FormalParameters are applied.
          • - If |BindingIdentifier| is present and the source text matched by |BindingIdentifier| is strict mode code, it is a Syntax Error if the StringValue of |BindingIdentifier| is either *"eval"* or *"arguments"*. + If |BindingIdentifier| is present and IsStrict(|BindingIdentifier|) is *true*, it is a Syntax Error if the StringValue of |BindingIdentifier| is either *"eval"* or *"arguments"*.
          • It is a Syntax Error if FunctionBodyContainsUseStrict of |GeneratorBody| is *true* and IsSimpleParameterList of |FormalParameters| is *false*. @@ -24154,8 +24167,8 @@

            Static Semantics: Early Errors

            `async` `function` `*` BindingIdentifier? `(` FormalParameters `)` `{` AsyncGeneratorBody `}`
              -
            • If the source text matched by |FormalParameters| is strict mode code, the Early Error rules for UniqueFormalParameters : FormalParameters are applied.
            • -
            • If |BindingIdentifier| is present and the source text matched by |BindingIdentifier| is strict mode code, it is a Syntax Error if the StringValue of |BindingIdentifier| is either *"eval"* or *"arguments"*.
            • +
            • If IsStrict(|FormalParameters|) is *true*, the Early Error rules for UniqueFormalParameters : FormalParameters are applied.
            • +
            • If |BindingIdentifier| is present and IsStrict(|BindingIdentifier|) is *true*, it is a Syntax Error if the StringValue of |BindingIdentifier| is either *"eval"* or *"arguments"*.
            • It is a Syntax Error if FunctionBodyContainsUseStrict of |AsyncGeneratorBody| is *true* and IsSimpleParameterList of |FormalParameters| is *false*.
            • It is a Syntax Error if any element of the BoundNames of |FormalParameters| also occurs in the LexicallyDeclaredNames of |AsyncGeneratorBody|.
            • It is a Syntax Error if |FormalParameters| Contains |YieldExpression| is *true*.
            • @@ -25099,8 +25112,8 @@

              Static Semantics: Early Errors

              • It is a Syntax Error if FunctionBodyContainsUseStrict of |AsyncFunctionBody| is *true* and IsSimpleParameterList of |FormalParameters| is *false*.
              • It is a Syntax Error if |FormalParameters| Contains |AwaitExpression| is *true*.
              • -
              • If the source text matched by |FormalParameters| is strict mode code, the Early Error rules for UniqueFormalParameters : FormalParameters are applied.
              • -
              • If |BindingIdentifier| is present and the source text matched by |BindingIdentifier| is strict mode code, it is a Syntax Error if the StringValue of |BindingIdentifier| is either *"eval"* or *"arguments"*.
              • +
              • If IsStrict(|FormalParameters|) is *true*, the Early Error rules for UniqueFormalParameters : FormalParameters are applied.
              • +
              • If |BindingIdentifier| is present and IsStrict(|BindingIdentifier|) is *true*, it is a Syntax Error if the StringValue of |BindingIdentifier| is either *"eval"* or *"arguments"*.
              • It is a Syntax Error if any element of the BoundNames of |FormalParameters| also occurs in the LexicallyDeclaredNames of |AsyncFunctionBody|.
              • It is a Syntax Error if |FormalParameters| Contains |SuperProperty| is *true*.
              • It is a Syntax Error if |AsyncFunctionBody| Contains |SuperProperty| is *true*.
              • @@ -25372,7 +25385,7 @@

                - 1. If the source text matched by _call_ is non-strict code, return *false*. + 1. If IsStrict(_call_) is *false*, return *false*. 1. If _call_ is not contained within a |FunctionBody|, a |ConciseBody|, or an |AsyncConciseBody|, return *false*. 1. Let _body_ be the |FunctionBody|, |ConciseBody|, or |AsyncConciseBody| that most closely contains _call_. 1. If _body_ is the |FunctionBody| of a |GeneratorBody|, return *false*. @@ -50494,7 +50507,7 @@

                Changes to Block Static Semantics: Early Errors

                Block : `{` StatementList `}`
                • - It is a Syntax Error if the LexicallyDeclaredNames of |StatementList| contains any duplicate entries, unless the source text matched by this production is not strict mode code and the duplicate entries are only bound by FunctionDeclarations. + It is a Syntax Error if the LexicallyDeclaredNames of |StatementList| contains any duplicate entries, unless IsStrict(this production) is *false* and the duplicate entries are only bound by FunctionDeclarations.
                • It is a Syntax Error if any element of the LexicallyDeclaredNames of |StatementList| also occurs in the VarDeclaredNames of |StatementList|. @@ -50508,7 +50521,7 @@

                  Changes to `switch` Statement Static Semantics: Early Errors

                  SwitchStatement : `switch` `(` Expression `)` CaseBlock
                  • - It is a Syntax Error if the LexicallyDeclaredNames of |CaseBlock| contains any duplicate entries, unless the source text matched by this production is not strict mode code and the duplicate entries are only bound by FunctionDeclarations. + It is a Syntax Error if the LexicallyDeclaredNames of |CaseBlock| contains any duplicate entries, unless IsStrict(this production) is *false* and the duplicate entries are only bound by FunctionDeclarations.
                  • It is a Syntax Error if any element of the LexicallyDeclaredNames of |CaseBlock| also occurs in the VarDeclaredNames of |CaseBlock|.