token is encountered and a LineTerminator is encountered before the next token, a semicolon is
automatically inserted after the continue
, break
, return
, throw
,
or yield
token.
The resulting practical advice to ECMAScript programmers is:
A postfix ++
or --
operator should appear on the same line as its operand.
An Expression in a return
or throw
statement or an AssignmentExpression in a yield
expression should start on the same line as the
return
, throw
, or yield
token.
An IdentifierReference in a break
or continue
statement should be
on the same line as the break
or continue
token.
The source
{ 1 2 } 3
is not a valid sentence in the ECMAScript grammar, even with the automatic semicolon insertion rules. In contrast, the source
{ 1
2 } 3
is also not a valid ECMAScript sentence, but is transformed by automatic semicolon insertion into the following:
{ 1
;2 ;} 3;
which is a valid ECMAScript sentence.
The source
for (a; b
)
is not a valid ECMAScript sentence and is not altered by automatic semicolon
insertion because the semicolon is needed for the header of a for
statement. Automatic semicolon insertion
never inserts one of the two semicolons in the header of a for
statement.
The source
return
a + b
is transformed by automatic semicolon insertion into the following:
return;
a + b;
NOTE 1 The expression a + b
is not treated as a value to be returned by the
return
statement, because a LineTerminator separates it from the token
return
.
The source
a = b
++c
is transformed by automatic semicolon insertion into the following:
a = b;
++c;
NOTE 2 The token ++
is not treated as a postfix operator applying to the variable
b
, because a LineTerminator occurs between b
and ++
.
The source
if (a > b)
else c = d
is not a valid ECMAScript sentence and is not altered by automatic semicolon
insertion before the else
token, even though no production of the grammar applies at that point, because an
automatically inserted semicolon would then be parsed as an empty statement.
The source
a = b + c
(d + e).print()
is not transformed by automatic semicolon insertion, because the parenthesized expression that begins the second line can be interpreted as an argument list for a function call:
a = b + c(d + e).print()
In the circumstance that an assignment statement must begin with a left parenthesis, it is a good idea for the programmer to provide an explicit semicolon at the end of the preceding statement rather than to rely on automatic semicolon insertion.
Syntax
yield
yield
yield
It is a Syntax Error if the code matched by this production is contained in strict
mode code and the StringValue of Identifier is "arguments"
or
"eval"
.
IdentifierReference : yield
BindingIdentifier :
yield
LabelIdentifier :
yield
It is a Syntax Error if the code matched by this production is contained in strict mode code.
IdentifierReference[Yield] : Identifier
BindingIdentifier[Yield] : Identifier
LabelIdentifier[Yield] :
Identifier
It is a Syntax Error if this production has a [Yield] parameter and StringValue of Identifier is "yield"
.
It is a Syntax Error if this phrase is contained in strict mode code and the
StringValue of IdentifierName is: "implements"
, "interface"
,
"let"
, "package"
, "private"
, "protected"
, "public"
,
"static"
, or "yield"
.
It is a Syntax Error if StringValue of IdentifierName is the same String value as the
StringValue of any ReservedWord except for yield
.
NOTE StringValue of IdentifierName normalizes any Unicode escape sequences in IdentifierName hence such escapes cannot be used to write an Identifier whose code point sequence is the same as a ReservedWord.
See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 14.1.3, 14.2.2, 14.4.2, 14.5.2, <IP_ADDRESS>, <IP_ADDRESS>.
yield
"yield"
.See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.6.2, 12.7.2, 12.8.2, 12.9.2, 12.10.2, 12.11.2, 12.12.2, 12.13.2, 12.14.3, 12.15.2.
"eval"
or "arguments"
, return false.yield
IdentifierReference : yield
BindingIdentifier :
yield
LabelIdentifier :
yield
"yield"
.With arguments value and environment.
NOTE undefined is passed for environment to indicate that a PutValue operation should be used to assign the initialization value. This is the case for
var
statements and formal parameter lists of some non-strict functions (See 9.2.12). In those cases a lexical binding is hoisted and preinitialized
prior to evaluation of its initializer.
yield
"yield"
, value,
environment).yield
"yield"
).NOTE 1 The result of evaluating an IdentifierReference is always a value of type Reference.
NOTE 2 In non-strict code, the keyword yield
may be used as an identifier. Evaluating the IdentifierReference production resolves the binding
of yield
as if it was an Identifier. Early Error restriction ensures that such an
evaluation only can occur for non-strict code. See 13.3.1 for the handling of yield
in binding creation contexts.
this
(
Expression[In, ?Yield] )
(
)
(
...
BindingIdentifier[?Yield] )
(
Expression[In, ?Yield] ,
...
BindingIdentifier[?Yield] )
When processing the production
PrimaryExpression[Yield] : CoverParenthesizedExpressionAndArrowParameterList[?Yield]
the interpretation of CoverParenthesizedExpressionAndArrowParameterList is refined using the following grammar:
(
Expression[In, ?Yield] )
(
Expression[In, ?Yield] )
See also: 14.1.8, 14.2.7, 14.4.7, 14.5.6.
See also: <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9, 14.5.8.
this
See also: <IP_ADDRESS>.
this
See also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.6.2, 12.7.2, 12.8.2, 12.9.2, 12.10.2, 12.11.2, 12.12.2, 12.13.2, 12.14.3, 12.15.2.
this
this
Keywordthis
See 12.1 for IdentifierReference.
false
.true
.NOTE An ArrayLiteral is an expression describing the initialization of an Array object, using a list, of zero or more expressions each of which represents an array element, enclosed in square brackets. The elements need not be literals; they are evaluated each time the array initializer is evaluated.
Array elements may be elided at the beginning, middle or end of the element list. Whenever a comma in the element list is not preceded by an AssignmentExpression (i.e., a comma at the beginning or after another comma), the missing array element contributes to the length of the Array and increases the index of subsequent elements. Elided array elements are not defined. If an element is elided at the end of an array, that element does not contribute to the length of the Array.
[
Elisionopt ]
[
ElementList[?Yield] ]
[
ElementList[?Yield] ,
Elisionopt ]
,
Elisionopt AssignmentExpression[In, ?Yield],
Elisionopt SpreadElement[?Yield],
,
...
AssignmentExpression[In, ?Yield],
,
With parameters array and nextIndex.
,
Elisionopt AssignmentExpression,
Elisionopt SpreadElement...
AssignmentExpressionNOTE CreateDataProperty is used to ensure that own properties are defined for the array even if the standard built-in Array prototype object has been modified in a manner that would preclude the creation of new own properties using [[Set]].
[
Elisionopt ]
"length"
, pad, false).[
ElementList ]
"length"
, len, false).[
ElementList ,
Elisionopt ]
"length"
, ToUint32(padding+len), false).NOTE 1 An object initializer is an expression describing the initialization of an Object, written in a form resembling a literal. It is a list of zero or more pairs of property keys and associated values, enclosed in curly brackets. The values need not be literals; they are evaluated each time the object initializer is evaluated.
{
}
{
PropertyDefinitionList[?Yield] }
{
PropertyDefinitionList[?Yield] ,
}
,
PropertyDefinition[?Yield]:
AssignmentExpression[In, ?Yield][
AssignmentExpression[In, ?Yield] ]
=
AssignmentExpression[?In, ?Yield]NOTE 2 MethodDefinition is defined in 14.3.
NOTE 3 In certain contexts, ObjectLiteral is used as a cover grammar for a more restricted secondary grammar. The CoverInitializedName production is necessary to fully cover these secondary grammars. However, use of this production results in an early Syntax Error in normal contexts where an actual ObjectLiteral is expected.
In addition to describing an actual object initializer the ObjectLiteral productions are also used as a cover grammar for ObjectAssignmentPattern (12.14.5). and may be recognized as part of a CoverParenthesizedExpressionAndArrowParameterList. When ObjectLiteral appears in a context where ObjectAssignmentPattern is required the following Early Error rules are not applied. In addition, they are not applied when initially parsing a CoverParenthesizedExpressionAndArrowParameterList.
NOTE This production exists so that ObjectLiteral can serve as a cover grammar for ObjectAssignmentPattern (12.14.5). It cannot occur in an actual object initializer.
With parameter symbol.
See also: 14.3.2, 14.4.3, 14.5.5.
With parameter symbol.
See also: 5.3, <IP_ADDRESS>, 14.1.4, 14.2.3, 14.4.4, 14.5.4.
NOTE Static semantic rules that depend upon substructure generally do not look into function definitions.
,
PropertyDefinition:
AssignmentExpressionSee also: 14.3.6, 14.4.10, 14.5.12
:
AssignmentExpression[
AssignmentExpression ]
,
PropertyDefinition{
}
{
PropertyDefinitionList }
{
PropertyDefinitionList ,
}
[
AssignmentExpression ]
With parameter object and enumerable.
See also: 14.3.9, 14.4.13, B.3.1
,
PropertyDefinition:
AssignmentExpression"name"
).NOTE An alternative semantics for this production is given in B.3.1.
See 14.1 for PrimaryExpression : FunctionExpression .
See 14.4 for PrimaryExpression : GeneratorExpression .
See 14.5 for PrimaryExpression : ClassExpression .
It is a Syntax Error if BodyText of RegularExpressionLiteral cannot be recognized using the goal symbol Pattern of the ECMAScript RegExp grammar specified in 21.2.1.
It is a Syntax Error if FlagText of RegularExpressionLiteral contains any code points other than "g"
, "i"
,
"m"
, "u"
, or "y"
, or if it contains the same code point more than once.
With parameter raw.
See also: <IP_ADDRESS>
The abstract operation GetTemplateObject is called with a grammar production, templateLiteral, as an argument. It performs the following steps:
"frozen"
)."raw"
, PropertyDescriptor{[[Value]]:
rawObj, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]:
false})."frozen"
).NOTE 1 The creation of a template object cannot result in an abrupt completion.
NOTE 2 Each TemplateLiteral in the program code of a Realm is associated with a unique template object that is used in the evaluation of tagged Templates (<IP_ADDRESS>). The template objects are frozen and the same template object is used each time a specific tagged Template is evaluated. Whether template objects are created lazily upon first evaluation of the TemplateLiteral or eagerly prior to first evaluation is an implementation choice that is not observable to ECMAScript code.
NOTE 3 Future editions of this specification may define additional non-enumerable properties of template objects.
NOTE 1 The string conversion semantics applied to the Expression
value are like String.prototype.concat
rather than the
+
operator.
NOTE 2 The string conversion semantics applied to the Expression
value are like String.prototype.concat
rather than the
+
operator.
NOTE 3 The string conversion semantics applied to the Expression
value are like String.prototype.concat
rather than the
+
operator.
It is a Syntax Error if the lexical token sequence matched by CoverParenthesizedExpressionAndArrowParameterList cannot be parsed with no tokens left over using ParenthesizedExpression as the goal symbol.
All Early Errors rules for ParenthesizedExpression and its derived productions also apply to CoveredParenthesizedExpression of CoverParenthesizedExpressionAndArrowParameterList.
See also: <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9, 14.5.8.
(
Expression )
See also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.6.2, 12.7.2, 12.8.2, 12.9.2, 12.10.2, 12.11.2, 12.12.2, 12.13.2, 12.14.3, 12.15.2.
(
Expression )
(
Expression )
NOTE This algorithm does not apply GetValue to the result of
evaluating Expression. The principal motivation for this is so that operators such as
delete
and typeof
may be applied to parenthesized expressions.
[
Expression[In, ?Yield] ]
.
IdentifierNamenew
MemberExpression[?Yield] Arguments[?Yield]super
[
Expression[In, ?Yield] ]
super
.
IdentifierNamenew
.
target
new
NewExpression[?Yield][
Expression[In, ?Yield] ]
.
IdentifierNamesuper
Arguments[?Yield](
)
(
ArgumentList[?Yield] )
...
AssignmentExpression[In, ?Yield],
AssignmentExpression[In, ?Yield],
...
AssignmentExpression[In, ?Yield]With parameter symbol.
See also: 5.3, <IP_ADDRESS>, 14.1.4, 14.2.3, 14.4.4, 14.5.4
.
IdentifierNamesuper
.
IdentifierNamesuper
, return true..
IdentifierNameSee also: <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9, 14.5.8.
[
Expression ]
.
IdentifierNamenew
MemberExpression Argumentsnew
NewExpression[
Expression ]
.
IdentifierNameSee also: <IP_ADDRESS>.
[
Expression ]
.
IdentifierNamenew
MemberExpression Argumentsnew
NewExpression[
Expression ]
.
IdentifierNameSee also: <IP_ADDRESS>.
[
Expression ]
.
IdentifierNamenew
MemberExpression Argumentsnew
NewExpressionSee also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.6.2, 12.7.2, 12.8.2, 12.9.2, 12.10.2, 12.11.2, 12.12.2, 12.13.2, 12.14.3, 12.15.2.
[
Expression ]
.
IdentifierName[
Expression ]
.
IdentifierNamenew
NewExpressionnew
MemberExpression Argumentsnew
.
target
NOTE Properties are accessed by name, using either the dot notation:
.
IdentifierName.
IdentifierNameor the bracket notation:
[
Expression ]
[
Expression ]
The dot notation is explained by the following syntactic conversion:
.
IdentifierNameis identical in its behaviour to
[
<identifier-name-string> ]
and similarly
.
IdentifierNameis identical in its behaviour to
[
<identifier-name-string> ]
where <identifier-name-string> is the result of evaluating StringValue of IdentifierName.
[
Expression ]
.
IdentifierName[
Expression ]
Is evaluated in exactly the same manner as MemberExpression : MemberExpression [
Expression ]
except that the contained CallExpression is evaluated in step 1.
.
IdentifierNameIs evaluated in exactly the same manner as MemberExpression : MemberExpression .
IdentifierName except that the contained CallExpression is evaluated
in step 1.
new
Operatornew
NewExpressionnew
MemberExpression ArgumentsThe abstract operation EvaluateNew with arguments constructProduction, and arguments performs the following steps:
"eval"
, then
A CallExpression evaluation that executes step 4.a.vii is a direct eval.
The abstract operation EvaluateCall takes as arguments a value ref, a syntactic grammar production arguments, and a Boolean argument tailPosition. It performs the following steps:
The abstract operation EvaluateDirectCall takes as arguments a value func, a value thisValue, a syntactic grammar production arguments, and a Boolean argument tailPosition. It performs the following steps:
super
Keywordsuper
[
Expression ]
super
.
IdentifierNamesuper
ArgumentsThe abstract operation GetSuperConstructor performs the following steps:
The abstract operation MakeSuperPropertyReference with arguments propertyKey and strict performs the following steps:
See also: <IP_ADDRESS>
(
)
...
AssignmentExpression,
AssignmentExpression,
...
AssignmentExpressionnew
.
target
++
--
++
--
It is an early Reference Error if IsValidSimpleAssignmentTarget of LeftHandSideExpression is false.
See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9, 14.5.8
++
--
See also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.5.3, 12.6.2, 12.7.2, 12.8.2, 12.9.2, 12.10.2, 12.11.2, 12.12.2, 12.13.2, 12.14.3, 12.15.2.
++
--
++
1
to oldValue, using the same rules as for
the +
operator (see 12.7.5).--
1
from oldValue, using the same rules
as for the -
operator (12.7.5).delete
UnaryExpression[?Yield]void
UnaryExpression[?Yield]typeof
UnaryExpression[?Yield]++
UnaryExpression[?Yield]--
UnaryExpression[?Yield]+
UnaryExpression[?Yield]-
UnaryExpression[?Yield]~
UnaryExpression[?Yield]!
UnaryExpression[?Yield]++
UnaryExpression--
UnaryExpressionIt is an early Reference Error if IsValidSimpleAssignmentTarget of UnaryExpression is false.
See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9, 14.5.8.
delete
UnaryExpressionvoid
UnaryExpressiontypeof
UnaryExpression++
UnaryExpression--
UnaryExpression+
UnaryExpression-
UnaryExpression~
UnaryExpression!
UnaryExpressionSee also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.6.2, 12.7.2, 12.8.2, 12.9.2, 12.10.2, 12.11.2, 12.12.2, 12.13.2, 12.14.3, 12.15.2.
delete
UnaryExpressionvoid
UnaryExpressiontypeof
UnaryExpression++
UnaryExpression--
UnaryExpression+
UnaryExpression-
UnaryExpression~
UnaryExpression!
UnaryExpressiondelete
Operatordelete
UnaryExpressionIt is a Syntax Error if the UnaryExpression is contained in strict mode code and the derived UnaryExpression is PrimaryExpression : IdentifierReference.
It is a Syntax Error if the derived UnaryExpression is
PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList
and CoverParenthesizedExpressionAndArrowParameterList ultimately derives a phrase that, if used in place
of UnaryExpression, would produce a Syntax Error according to these rules. This rule is recursively
applied.
NOTE The last rule means that expressions such as
delete
(((foo)))
produce early errors because of recursive application of the first rule.
delete
UnaryExpressionNOTE When a delete
operator occurs within strict
mode code, a SyntaxError exception is thrown if its UnaryExpression is a direct
reference to a variable, function argument, or function name. In addition, if a delete
operator occurs
within strict mode code and the property to be deleted has the attribute {
[[Configurable]]: false }, a TypeError exception is thrown.
void
Operatorvoid
UnaryExpressionNOTE GetValue must be called even though its value is not used because it may have observable side-effects.
typeof
Operatortypeof
UnaryExpression"undefined"
.| Type of val | Result |
|---|---|
| Undefined | "undefined" |
| Null | "object" |
| Boolean | "boolean" |
| Number | "number" |
| String | "string" |
| Symbol | "symbol" |
| Object (ordinary and does not implement [[Call]]) | "object" |
| Object (standard exotic and does not implement [[Call]]) | "object" |
| Object (implements [[Call]]) | "function" |
| Object (non-standard exotic and does not implement [[Call]]) | Implementation-defined. Must not be "undefined" , "boolean" , "function" , "number" , "symbol" , or "string". |
NOTE Implementations are discouraged from defining new typeof
result values for
non-standard exotic objects. If possible "object"
should be used for such objects.
++
UnaryExpression1
to oldValue, using the same rules as for
the +
operator (see 12.7.5).--
UnaryExpression1
from oldValue, using the same
rules as for the -
operator (see
12.7.5).+
OperatorNOTE The unary + operator converts its operand to Number type.
+
UnaryExpression-
OperatorNOTE The unary -
operator converts its operand to Number type and then negates
it. Negating +0 produces −0, and negating −0 produces +0.
-
UnaryExpression~
)~
UnaryExpression!
)!
UnaryExpression*
/
%
See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9, 14.5.8.
MultiplicativeExpression : MultiplicativeExpression MultiplicativeOperator UnaryExpression
See also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.7.2, 12.8.2, 12.9.2, 12.10.2, 12.11.2, 12.12.2, 12.13.2, 12.14.3, 12.15.2.
MultiplicativeExpression : MultiplicativeExpression MultiplicativeOperator UnaryExpression
MultiplicativeExpression : MultiplicativeExpression MultiplicativeOperator UnaryExpression
*
OperatorThe *
MultiplicativeOperator performs multiplication, producing the product of its
operands. Multiplication is commutative. Multiplication is not always associative in ECMAScript, because of finite
precision.
The result of a floating-point multiplication is governed by the rules of IEEE 754-2008 binary double-precision arithmetic:
If either operand is NaN, the result is NaN.
The sign of the result is positive if both operands have the same sign, negative if the operands have different signs.
Multiplication of an infinity by a zero results in NaN.
Multiplication of an infinity by an infinity results in an infinity. The sign is determined by the rule already stated above.
Multiplication of an infinity by a finite nonzero value results in a signed infinity. The sign is determined by the rule already stated above.
In the remaining cases, where neither an infinity nor NaN is involved, the product is computed and rounded to the nearest representable value using IEEE 754-2008 round-to-nearest mode. If the magnitude is too large to represent, the result is then an infinity of appropriate sign. If the magnitude is too small to represent, the result is then a zero of appropriate sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754-2008.
/
OperatorThe /
MultiplicativeOperator performs division, producing the quotient of its
operands. The left operand is the dividend and the right operand is the divisor. ECMAScript does not perform integer
division. The operands and result of all division operations are double-precision floating-point numbers. The result of
division is determined by the specification of IEEE 754-2008 arithmetic:
If either operand is NaN, the result is NaN.
The sign of the result is positive if both operands have the same sign, negative if the operands have different signs.
Division of an infinity by an infinity results in NaN.
Division of an infinity by a zero results in an infinity. The sign is determined by the rule already stated above.
Division of an infinity by a nonzero finite value results in a signed infinity. The sign is determined by the rule already stated above.
Division of a finite value by an infinity results in zero. The sign is determined by the rule already stated above.
Division of a zero by a zero results in NaN; division of zero by any other finite value results in zero, with the sign determined by the rule already stated above.
Division of a nonzero finite value by a zero results in a signed infinity. The sign is determined by the rule already stated above.
In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the quotient is computed and rounded to the nearest representable value using IEEE 754-2008 round-to-nearest mode. If the magnitude is too large to represent, the operation overflows; the result is then an infinity of appropriate sign. If the magnitude is too small to represent, the operation underflows and the result is a zero of the appropriate sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754-2008.
%
OperatorThe %
MultiplicativeOperator yields the remainder of its operands from an implied
division; the left operand is the dividend and the right operand is the divisor.
NOTE In C and C++, the remainder operator accepts only integral operands; in ECMAScript, it also accepts floating-point operands.
The result of a floating-point remainder operation as computed by the %
operator is not the same as the
“remainder” operation defined by IEEE 754-2008. The IEEE 754-2008 “remainder” operation computes
the remainder from a rounding division, not a truncating division, and so its behaviour is not analogous to that of the
usual integer remainder operator. Instead the ECMAScript language defines %
on floating-point operations to
behave in a manner analogous to that of the Java integer remainder operator; this may be compared with the C library
function fmod.
The result of an ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetic:
If either operand is NaN, the result is NaN.
The sign of the result equals the sign of the dividend.
If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN.
If the dividend is finite and the divisor is an infinity, the result equals the dividend.
If the dividend is a zero and the divisor is nonzero and finite, the result is the same as the dividend.
In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the floating-point remainder r from a dividend n and a divisor d is defined by the mathematical relation r = n − (d × q) where q is an integer that is negative only if n/d is negative and positive only if n/d is positive, and whose magnitude is as large as possible without exceeding the magnitude of the true mathematical quotient of n and d. r is computed and rounded to the nearest representable value using IEEE 754-2008 round-to-nearest mode.
+
MultiplicativeExpression[?Yield]-
MultiplicativeExpression[?Yield]See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9, 14.5.8.
+
MultiplicativeExpression-
MultiplicativeExpressionSee also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.6.2, 12.8.2, 12.9.2, 12.10.2, 12.11.2, 12.12.2, 12.13.2, 12.14.3, 12.15.2.
+
MultiplicativeExpression-
MultiplicativeExpression+
)NOTE The addition operator either performs string concatenation or numeric addition.
+
MultiplicativeExpressionNOTE 1 No hint is provided in the calls to ToPrimitive in steps 7 and 9. All standard objects except Date objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the hint String were given. Exotic objects may handle the absence of a hint in some other manner.
NOTE 2 Step 11 differs from step 5 of the Abstract Relational Comparison algorithm (7.2.11), by using the logical-or operation instead of the logical-and operation.
-
)-
MultiplicativeExpressionThe +
operator performs addition when applied to two operands of numeric type, producing the sum of the
operands. The -
operator performs subtraction, producing the difference of two numeric operands.
Addition is a commutative operation, but not always associative.
The result of an addition is determined using the rules of IEEE 754-2008 binary double-precision arithmetic:
If either operand is NaN, the result is NaN.
The sum of two infinities of opposite sign is NaN.
The sum of two infinities of the same sign is the infinity of that sign.
The sum of an infinity and a finite value is equal to the infinite operand.
The sum of two negative zeroes is −0. The sum of two positive zeroes, or of two zeroes of opposite sign, is +0.
The sum of a zero and a nonzero finite value is equal to the nonzero operand.
The sum of two nonzero finite values of the same magnitude and opposite sign is +0.
In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, and the operands have the same sign or have different magnitudes, the sum is computed and rounded to the nearest representable value using IEEE 754-2008 round-to-nearest mode. If the magnitude is too large to represent, the operation overflows and the result is then an infinity of appropriate sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754-2008.
NOTE The -
operator performs subtraction when applied to two operands of numeric
type, producing the difference of its operands; the left operand is the minuend and the right operand is the subtrahend.
Given numeric operands a and b, it is always the case that a–
b produces the same result as
a +(–
b)
.
<<
AdditiveExpression[?Yield]>>
AdditiveExpression[?Yield]>>>
AdditiveExpression[?Yield]See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9, 14.5.8.
<<
AdditiveExpression>>
AdditiveExpression>>>
AdditiveExpressionSee also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.6.2, 12.7.2, 12.9.2, 12.10.2, 12.11.2, 12.12.2, 12.13.2, 12.14.3, 12.15.2.
<<
AdditiveExpression>>
AdditiveExpression>>>
AdditiveExpression<<
)NOTE Performs a bitwise left shift operation on the left operand by the amount specified by the right operand.
<<
AdditiveExpression>>
)NOTE Performs a sign-filling bitwise right shift operation on the left operand by the amount specified by the right operand.
>>
AdditiveExpression>>>
)NOTE Performs a zero-filling bitwise right shift operation on the left operand by the amount specified by the right operand.
>>>
AdditiveExpressionNOTE 1 The result of evaluating a relational operator is always of type Boolean, reflecting whether the relationship named by the operator holds between its two operands.
<
ShiftExpression[?Yield]>
ShiftExpression[?Yield]<=
ShiftExpression[? Yield]>=
ShiftExpression[?Yield]instanceof
ShiftExpression[?Yield]in
ShiftExpression[?Yield]NOTE 2 The [In] grammar parameter is needed to avoid confusing the in
operator in
a relational expression with the in
operator in a for
statement.
See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9, 14.5.8.
<
ShiftExpression>
ShiftExpression<=
ShiftExpression>=
ShiftExpressioninstanceof
ShiftExpressionin
ShiftExpressionSee also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.6.2, 12.7.2, 12.8.2, 12.10.2, 12.11.2, 12.12.2, 12.13.2, 12.14.3, 12.15.2.
<
ShiftExpression>
ShiftExpression<=
ShiftExpression>=
ShiftExpressioninstanceof
ShiftExpressionin
ShiftExpression<
ShiftExpression>
ShiftExpression<=
ShiftExpression>=
ShiftExpressioninstanceof
ShiftExpressionin
ShiftExpressionThe abstract operation InstanceofOperator(O, C) implements the generic algorithm for determining if an object O inherits from the inheritance path defined by constructor C. This abstract operation performs the following steps:
NOTE Steps 5 and 6 provide compatibility with previous editions of ECMAScript that did not use
a @@hasInstance method to define the instanceof
operator semantics. If a function object does not define or
inherit @@hasInstance it uses the default instanceof
semantics.
NOTE The result of evaluating an equality operator is always of type Boolean, reflecting whether the relationship named by the operator holds between its two operands.
==
RelationalExpression[?In, ?Yield]!=
RelationalExpression[?In, ?Yield]===
RelationalExpression[?In, ?Yield]!==
RelationalExpression[?In, ?Yield]See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9, 14.5.8.
==
RelationalExpression!=
RelationalExpression===
RelationalExpression!==
RelationalExpressionSee also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.6.2, 12.7.2, 12.8.2, 12.9.2, 12.11.2, 12.12.2, 12.13.2, 12.14.3, 12.15.2.
==
RelationalExpression!=
RelationalExpression===
RelationalExpression!==
RelationalExpression==
RelationalExpression!=
RelationalExpression===
RelationalExpression!==
RelationalExpressionNOTE 1 Given the above definition of equality:
"" + a == "" + b
.+a == +b
.!a == !b
.NOTE 2 The equality operators maintain the following invariants:
A
!=
B
is equivalent to !(A
==
B)
.A
==
B
is equivalent to B
==
A
, except
in the order of evaluation of A
and B
.NOTE 3 The equality operator is not always transitive. For example, there might be two distinct
String objects, each representing the same String value; each String object would be considered equal to the String value
by the ==
operator, but the two String objects would not be equal to each other. For example:
new String("a") == "a"
and "a" == new String("a")
are both true.new String("a") == new String("a")
is false.NOTE 4 Comparison of Strings uses a simple equality test on sequences of code unit values. There is no attempt to use the more complex, semantically oriented definitions of character or string equality and collating order defined in the Unicode specification. Therefore Strings values that are canonically equal according to the Unicode standard could test as unequal. In effect this algorithm assumes that both Strings are already in normalized form.
&
EqualityExpression[?In, ?Yield]^
BitwiseANDExpression[?In, ?Yield]|
BitwiseXORExpression[?In, ?Yield]See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9, 14.5.8.
BitwiseANDExpression : BitwiseANDExpression &
EqualityExpression
BitwiseXORExpression : BitwiseXORExpression ^
BitwiseANDExpression
BitwiseORExpression : BitwiseORExpression |
BitwiseXORExpression
See also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.6.2, 12.7.2, 12.8.2, 12.9.2, 12.10.2, 12.12.2, 12.13.2, 12.14.3, 12.15.2.
BitwiseANDExpression : BitwiseANDExpression &
EqualityExpression
BitwiseXORExpression : BitwiseXORExpression ^
BitwiseANDExpression
BitwiseORExpression : BitwiseORExpression |
BitwiseXORExpression
The production A : A @ B, where @ is one of the bitwise operators in the productions above, is evaluated as follows:
&&
BitwiseORExpression[?In, ?Yield]||
LogicalANDExpression[?In, ?Yield]NOTE The value produced by a &&
or ||
operator is not
necessarily of type Boolean. The value produced will always be the value of one of the two operand expressions.
See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9, 14.5.8.
LogicalANDExpression : LogicalANDExpression &&
BitwiseORExpression
LogicalORExpression : LogicalORExpression ||
LogicalANDExpression
See also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.6.2, 12.7.2, 12.8.2, 12.9.2, 12.10.2, 12.11.2, 12.13.2, 12.14.3, 12.15.2.
LogicalANDExpression : LogicalANDExpression &&
BitwiseORExpression
LogicalORExpression : LogicalORExpression ||
LogicalANDExpression
&&
BitwiseORExpression||
LogicalANDExpression? : )
?
AssignmentExpression[In, ?Yield] :
AssignmentExpression[?In, ?Yield]NOTE The grammar for a ConditionalExpression in ECMAScript is slightly different from that in C and Java, which each allow the second subexpression to be an Expression but restrict the third expression to be a ConditionalExpression. The motivation for this difference in ECMAScript is to allow an assignment expression to be governed by either arm of a conditional and to eliminate the confusing and fairly useless case of a comma expression as the centre expression.
See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9, 14.5.8.
?
AssignmentExpression :
AssignmentExpressionSee also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.6.2, 12.7.2, 12.8.2, 12.9.2, 12.10.2, 12.11.2, 12.12.2, 12.14.3, 12.15.2.
?
AssignmentExpression :
AssignmentExpression?
AssignmentExpression :
AssignmentExpression=
AssignmentExpression[?In, ?Yield]*=
/=
%=
+=
-=
<<=
>>=
>>>=
&=
^=
|=
=
AssignmentExpressionIt is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol.
It is an early Reference Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget of LeftHandSideExpression is false.
It is an early Reference Error if IsValidSimpleAssignmentTarget of LeftHandSideExpression is false.
See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.15.1, 14.1.11, 14.4.9, 14.5.8.
=
AssignmentExpressionSee also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.6.2, 12.7.2, 12.8.2, 12.9.2, 12.10.2, 12.11.2, 12.12.2, 12.13.2, 12.15.2.
=
AssignmentExpressionAssignmentExpression[In, Yield] : LeftHandSideExpression[?Yield] =
AssignmentExpression[?In, ?Yield]
"name"
).@
where AssignmentOperator is @=
NOTE When an assignment occurs within strict mode code, it is an runtime error if lref in step 1.f.of the first algorithm or step 9 of the second algorithm it is an unresolvable reference. If it is, a ReferenceError exception is thrown. The LeftHandSide also may not be a reference to a data property with the attribute value {[[Writable]]:false}, to an accessor property with the attribute value {[[Set]]:undefined}, nor to a non-existent property of an object for which the IsExtensible predicate returns the value false. In these cases a TypeError exception is thrown.
In certain circumstances when processing the production AssignmentExpression
: LeftHandSideExpression =
AssignmentExpression the following grammar is used to refine the interpretation of LeftHandSideExpression.
{
}
{
AssignmentPropertyList[?Yield] }
{
AssignmentPropertyList[?Yield] ,
}
[
Elisionopt AssignmentRestElement[?Yield]opt ]
[
AssignmentElementList[?Yield] ]
[
AssignmentElementList[?Yield] ,
Elisionopt AssignmentRestElement[?Yield]opt ]
,
AssignmentProperty[?Yield],
AssignmentElisionElement[?Yield]:
AssignmentElement[?Yield]...
DestructuringAssignmentTarget[?Yield]It is a Syntax Error if IsValidSimpleAssignmentTarget of IdentifierReference is false.
It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol.
It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is false.
with parameter value
{
}
{
AssignmentPropertyList }
{
AssignmentPropertyList ,
}
[
]
[
Elision ]
[
Elisionopt AssignmentRestElement ]
[
AssignmentElementList ]
[
AssignmentElementList ,
Elisionopt AssignmentRestElementopt ]
,
AssignmentProperty"name"
).:
AssignmentElementwith parameters iteratorRecord
,
AssignmentElisionElement,
,
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
"name"
).NOTE Left to right evaluation order is maintained by evaluating a DestructuringAssignmentTarget that is not a destructuring pattern prior to accessing the iterator or evaluating the Initializer.
AssignmentRestElement[Yield] : ...
DestructuringAssignmentTarget
with parameters value and propertyName
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
"name"
)., )
,
AssignmentExpression[?In, ?Yield]See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 14.1.11, 14.4.9, 14.5.8.
,
AssignmentExpressionSee also: 12.1.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.3, 12.5.3, 12.6.2, 12.7.2, 12.8.2, 12.9.2, 12.10.2, 12.11.2, 12.12.2, 12.13.2, 12.14.3.
,
AssignmentExpression,
AssignmentExpressionNOTE GetValue must be called even though its value is not used because it may have observable side-effects.
With argument labelSet.
See also: 13.2.2, 13.6.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.2, 13.12.2, 13.13.2, 13.15.2, <IP_ADDRESS>.
With argument labelSet.
See also: 13.2.3, 13.6.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.9.2, 13.11.3, 13.12.3, 13.13.3, 13.15.3, <IP_ADDRESS>.
With arguments iterationSet and labelSet.
See also: 13.2.4, 13.6.4, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.8.2, 13.11.4, 13.12.4, 13.13.4,13.15.4, <IP_ADDRESS>.
See also: 13.2.11, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.13.12, 13.15.5, 14.1.15, 14.2.12, 15.1.5, <IP_ADDRESS>.
See also: 13.2.12, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.13.13, 13.15.6, 14.1.16, 14.2.13, 15.1.6, <IP_ADDRESS>.
With argument labelSet.
See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.13.14.
NOTE A BreakableStatement is one that can be exited via an unlabelled BreakStatement.
{
StatementList[?Yield, ?Return]opt }
{
StatementList }
It is a Syntax Error if the LexicallyDeclaredNames of StatementList contains any duplicate entries.
It is a Syntax Error if any element of the LexicallyDeclaredNames of StatementList also occurs in the VarDeclaredNames of StatementList.
With argument labelSet.
See also: 13.1.1, 13.6.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.2, 13.12.2, 13.13.2, 13.15.2, <IP_ADDRESS>.
{
}
With argument labelSet.
See also: 13.1.2, 13.6.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.9.2, 13.11.3, 13.12.3, 13.13.3, 13.15.3, <IP_ADDRESS>.
{
}
With arguments iterationSet and labelSet.
See also: 13.1.3, 13.6.4, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.8.2, 13.11.4, 13.12.4, 13.13.4,13.15.4, <IP_ADDRESS>.
{
}
See also: 13.12.5, 13.13.6, 14.1.13, 14.2.10, 15.1.3, <IP_ADDRESS>.
{
}
See also: 13.12.6, 13.13.7, 14.1.14, 14.2.11, 15.1.4, <IP_ADDRESS>, <IP_ADDRESS>.
See also: 13.13.8.
NOTE At the top level of a function, or script, function declarations are treated like var declarations rather than like lexical declarations.
See also: 13.13.9.
{
}
See also: 13.13.10.
{
}
NOTE At the top level of a function or script, inner function declarations are treated like var declarations.
See also: 13.13.11.
{
}
See also: 13.1.5, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.13.12, 13.15.5, 14.1.15, 14.2.12, 15.1.5, <IP_ADDRESS>.
{
}
See also: 13.1.6, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.13.13, 13.15.6, 14.1.16, 14.2.13, 15.1.6, <IP_ADDRESS>.
{
}
{
}
{
StatementList }
NOTE 1 No matter how control leaves the Block the LexicalEnvironment is always restored to its former state.
NOTE 2 The value of a StatementList is the value of the last value
producing item in the StatementList. For example, the following calls to the eval
function all return the value 1:
eval("1;;;;;")
eval("1;{}")
eval("1;var a;")
NOTE When a Block or CaseBlock production is evaluated a new declarative Environment Record is created and bindings for each block scoped variable, constant, function, generator function, or class declared in the block are instantiated in the Environment Record.
BlockDeclarationInstantiation is performed as follows using arguments code and env. code is the grammar production corresponding to the body of the block. env is the declarative Environment Record in which bindings are to be created.
NOTE let
and const
declarations define variables that are scoped to
the running execution context’s LexicalEnvironment. The variables are created when their containing Lexical Environment is instantiated but may not be accessed in any way until the
variable’s LexicalBinding is evaluated. A variable defined by a LexicalBinding with an Initializer is assigned the value of its Initializer’s AssignmentExpression when
the LexicalBinding is evaluated, not when the variable is created. If a LexicalBinding in a let
declaration does not have an Initializer
the variable is assigned the value undefined when the LexicalBinding is evaluated.
;
let
const
,
LexicalBinding[?In, ?Yield];
"let"
.It is a Syntax Error if Initializer is not present and IsConstantDeclaration of the LexicalDeclaration containing this production is true.
See also: 12.1.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 14.1.3, 14.2.2, 14.4.2, 14.5.2, <IP_ADDRESS>, <IP_ADDRESS>.
;
,
LexicalBindingSee also: 14.1.10, 14.4.8, 14.5.7, <IP_ADDRESS>.
;
let
const
;
,
LexicalBindingNOTE A static semantics rule ensures that this form of LexicalBinding
never occurs in a const
declaration.
"name"
).NOTE A var
statement declares variables that are scoped to the running execution context’s VariableEnvironment. Var variables are created when their containing Lexical Environment is instantiated and are initialized to undefined when
created. Within the scope of any VariableEnvironment a common BindingIdentifier may appear in more than one VariableDeclaration but those
declarations collective define only one variable. A variable defined by a VariableDeclaration
with an Initializer is assigned the value of its Initializer’s AssignmentExpression when the VariableDeclaration is executed, not when the variable is created.
var
VariableDeclarationList[In, ?Yield] ;
,
VariableDeclaration[?In, ?Yield]See also: 12.1.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 14.1.3, 14.2.2, 14.4.2, 14.5.2, <IP_ADDRESS>, <IP_ADDRESS>.
,
VariableDeclarationSee also: 13.1.5, 13.2.11, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.13.12, 13.15.5, 14.1.15, 14.2.12, 15.1.5, <IP_ADDRESS>.
var
VariableDeclarationList ;
See also: 13.1.6, 13.2.12, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.13.13, 13.15.6, 14.1.16, 14.2.13, 15.1.6, <IP_ADDRESS>.
,
VariableDeclarationvar
VariableDeclarationList ;
,
VariableDeclaration"name"
).NOTE If a VariableDeclaration is nested within a with statement and the BindingIdentifier in the VariableDeclaration is the same as a property name of the binding object of the with statement’s object Environment Record, then step 7 will assign value to the property instead of assigning to the VariableEnvironment binding of the Identifier.
{
}
{
BindingPropertyList[?Yield] }
{
BindingPropertyList[?Yield] ,
}
[
Elisionopt BindingRestElement[?Yield]opt ]
[
BindingElementList[?Yield] ]
[
BindingElementList[?Yield] ,
Elisionopt BindingRestElement[?Yield]opt ]
,
BindingProperty[?Yield],
BindingElisionElement[?Yield]:
BindingElement[?Yield]...
BindingIdentifier[?Yield]See also: 12.1.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 14.1.3, 14.2.2, 14.4.2, 14.5.2, <IP_ADDRESS>, <IP_ADDRESS>.
{
}
[
Elisionopt ]
[
Elisionopt BindingRestElement ]
[
BindingElementList ,
Elisionopt ]
[
BindingElementList ,
Elisionopt BindingRestElement ]
,
BindingProperty,
BindingElisionElement:
BindingElement{
}
[
Elisionopt ]
[
Elisionopt BindingRestElement ]
[
BindingElementList ,
Elisionopt ]
[
BindingElementList ,
Elisionopt BindingRestElement ]
,
BindingProperty,
BindingElisionElement:
BindingElementWith parameters value and environment.
NOTE When undefined is passed for environment it indicates that a PutValue operation should be used to assign the initialization value. This is the case for formal parameter lists of non-strict functions. In that case the formal parameter bindings are preinitialized in order to deal with the possibility of multiple parameters with the same name.
{
}
,
BindingProperty:
BindingElementWith parameters iteratorRecord, and environment.
NOTE When undefined is passed for environment it indicates that a PutValue operation should be used to assign the initialization value. This is the case for formal parameter lists of non-strict functions. In that case the formal parameter bindings are preinitialized in order to deal with the possibility of multiple parameters with the same name.
[
]
[
Elision ]
[
Elisionopt BindingRestElement ]
[
BindingElementList ]
[
BindingElementList ,
]
[
BindingElementList ,
Elision ]
[
BindingElementList ,
Elisionopt BindingRestElement ]
,
BindingElisionElement"name"
)....
BindingIdentifierWith parameters value, environment, and propertyName.
NOTE When undefined is passed for environment it indicates that a PutValue operation should be used to assign the initialization value. This is the case for formal parameter lists of non-strict functions. In that case the formal parameter bindings are preinitialized in order to deal with the possibility of multiple parameters with the same name.
"name"
).;
{
, function
, class
, let [
}] Expression[In, ?Yield] ;
NOTE An ExpressionStatement cannot start with a U+007B (LEFT CURLY
BRACKET) because that might make it ambiguous with a Block. Also, an ExpressionStatement cannot start with the function
or class
keywords because
that would make it ambiguous with a FunctionDeclaration, a GeneratorDeclaration, or a ClassDeclaration. An ExpressionStatement cannot start with the two token sequence let [
because that would make
it ambiguous with a let
LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern.
;
if
Statementif
(
Expression[In, ?Yield] )
Statement[?Yield, ?Return] else
Statement[?Yield, ?Return]if
(
Expression[In, ?Yield] )
Statement[?Yield, ?Return]Each else
for which the choice of associated if
is ambiguous shall be associated with the
nearest possible if that would otherwise have no corresponding else
.
if
(
Expression )
Statement else
Statementif
(
Expression )
StatementNOTE It is only necessary to apply this rule if the extension specified in B.3.2 is implemented.
With argument labelSet.
See also: 13.1.1, 13.2.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.2, 13.12.2, 13.13.2, 13.15.2, <IP_ADDRESS>.
if
(
Expression )
Statement else
Statementif
(
Expression )
StatementWith argument labelSet.
See also: 13.1.2, 13.2.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.9.2, 13.11.3, 13.12.3, 13.13.3, 13.15.3, <IP_ADDRESS>.
if
(
Expression )
Statement else
Statementif
(
Expression )
StatementWith arguments iterationSet and labelSet.
See also: 13.1.3, 13.2.4, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.8.2, 13.11.4, 13.12.4, 13.13.4,13.15.4, <IP_ADDRESS>.
if
(
Expression )
Statement else
Statementif
(
Expression )
StatementSee also: 13.1.5, 13.2.11, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.13.12, 13.15.5, 14.1.15, 14.2.12, 15.1.5, <IP_ADDRESS>.
if
(
Expression )
Statement else
Statementif
(
Expression )
StatementSee also: 13.1.6, 13.2.12, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.13.13, 13.15.6, 14.1.16, 14.2.13, 15.1.6, <IP_ADDRESS>.
if
(
Expression )
Statement else
Statementif
(
Expression )
Statementif
(
Expression )
Statement else
Statementif
(
Expression )
Statementdo
Statement[?Yield, ?Return] while
(
Expression[In, ?Yield] )
;
while
(
Expression[In, ?Yield] )
Statement[?Yield, ?Return]for
(
[lookahead ∉ {let [
}] Expression[?Yield]opt ;
Expression[In, ?Yield]opt ;
Expression[In, ?Yield]opt )
Statement[?Yield, ?Return]for
(
var
VariableDeclarationList[?Yield] ;
Expression[In, ?Yield]opt ;
Expression[In, ?Yield]opt )
Statement[?Yield, ?Return]for
(
LexicalDeclaration[?Yield] Expression[In, ?Yield]opt ;
Expression[In, ?Yield]opt )
Statement[?Yield, ?Return]for
(
[lookahead ∉ {let [
}] LeftHandSideExpression[?Yield] in
Expression[In, ?Yield] )
Statement[?Yield, ?Return]for
(
var
ForBinding[?Yield] in
Expression[In, ?Yield] )
Statement[?Yield, ?Return]for
(
ForDeclaration[?Yield] in
Expression[In, ?Yield] )
Statement[?Yield, ?Return]for
(
[lookahead ≠ let ] LeftHandSideExpression[?Yield] of
AssignmentExpression[In, ?Yield] )
Statement[?Yield, ?Return]for
(
var
ForBinding[?Yield] of
AssignmentExpression[In, ?Yield] )
Statement[?Yield, ?Return]for
(
ForDeclaration[?Yield] of
AssignmentExpression[In, ?Yield] )
Statement[?Yield, ?Return]do
Statement while
(
Expression )
;
while
(
Expression )
Statementfor
(
Expressionopt ;
Expressionopt ;
Expressionopt )
Statementfor
(
var
VariableDeclarationList ;
Expressionopt ;
Expressionopt )
Statementfor
(
LexicalDeclaration Expressionopt ;
Expressionopt )
Statementfor
(
LeftHandSideExpression in
Expression )
Statementfor
(
var
ForBinding in
Expression )
Statementfor
(
ForDeclaration in
Expression )
Statementfor
(
LeftHandSideExpression of
AssignmentExpression )
Statementfor
(
var
ForBinding of
AssignmentExpression )
Statementfor
(
ForDeclaration of
AssignmentExpression )
StatementNOTE It is only necessary to apply this rule if the extension specified in B.3.2 is implemented.
The abstract operation LoopContinues with arguments completion and labelSet is defined by the following steps:
NOTE Within the Statement part of an IterationStatement a ContinueStatement may be used to begin a new iteration.
do
-while
StatementWith argument labelSet.
See also: 13.1.1, 13.2.2, 13.6.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.2, 13.12.2, 13.13.2, 13.15.2, <IP_ADDRESS>.
do
Statement while
(
Expression )
;
With argument labelSet.
See also: 13.1.2, 13.2.3, 13.6.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.9.2, 13.11.3, 13.12.3, 13.13.3, 13.15.3, <IP_ADDRESS>.
do
Statement while
(
Expression )
;
With arguments iterationSet and labelSet.
See also: 13.1.3, 13.2.4, 13.6.4, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.8.2, 13.11.4, 13.12.4, 13.13.4,13.15.4, <IP_ADDRESS>.
do
Statement while
(
Expression )
;
See also: 13.1.5, 13.2.11, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.13.12, 13.15.5, 14.1.15, 14.2.12, 15.1.5, <IP_ADDRESS>.
do
Statement while
(
Expression )
;
See also: 13.1.6, 13.2.12, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.13.13, 13.15.6, 14.1.16, 14.2.13, 15.1.6, <IP_ADDRESS>.
do
Statement while
(
Expression )
;
With argument labelSet.
See also: 13.1.7, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.13.14.
do
Statement while
(
Expression )
;
while
StatementWith argument labelSet.
See also: 13.1.1, 13.2.2, 13.6.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.2, 13.12.2, 13.13.2, 13.15.2, <IP_ADDRESS>.
while
(
Expression )
StatementWith argument labelSet.
See also: 13.1.2, 13.2.3, 13.6.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.9.2, 13.11.3, 13.12.3, 13.13.3, 13.15.3, <IP_ADDRESS>.
while
(
Expression )
StatementWith arguments iterationSet and labelSet.
See also: 13.1.3, 13.2.4, 13.6.4, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.8.2, 13.11.4, 13.12.4, 13.13.4,13.15.4, <IP_ADDRESS>.
while
(
Expression )
StatementSee also: 13.1.5, 13.2.11, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.13.12, 13.15.5, 14.1.15, 14.2.12, 15.1.5, <IP_ADDRESS>.
while
(
Expression )
StatementSee also: 13.1.6, 13.2.12, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.13.13, 13.15.6, 14.1.16, 14.2.13, 15.1.6, <IP_ADDRESS>.
while
(
Expression )
StatementWith argument labelSet.
See also: 13.1.7, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.13.14.
while
(
Expression )
Statementfor
Statementfor
(
LexicalDeclaration Expressionopt ;
Expressionopt )
StatementIt is a Syntax Error if any element of the BoundNames of LexicalDeclaration also occurs in the VarDeclaredNames of Statement.
With argument labelSet.
See also: 13.1.1, 13.2.2, 13.6.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.2, 13.12.2, 13.13.2, 13.15.2, <IP_ADDRESS>.
for
(
Expressionopt ;
Expressionopt ;
Expressionopt )
Statementfor
(
var
VariableDeclarationList ;
Expressionopt ;
Expressionopt )
Statementfor
(
LexicalDeclaration Expressionopt ;
Expressionopt )
StatementWith argument labelSet.
See also: 13.1.2, 13.2.3, 13.6.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.9.2, 13.11.3, 13.12.3, 13.13.3, 13.15.3, <IP_ADDRESS>.
for
(
Expressionopt ;
Expressionopt ;
Expressionopt )
Statementfor
(
var
VariableDeclarationList ;
Expressionopt ;
Expressionopt )
Statementfor
(
LexicalDeclaration Expressionopt ;
Expressionopt )
StatementWith arguments iterationSet and labelSet.
See also: 13.1.3, 13.2.4, 13.6.4, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.8.2, 13.11.4, 13.12.4, 13.13.4,13.15.4, <IP_ADDRESS>.
for
(
Expressionopt ;
Expressionopt ;
Expressionopt )
Statementfor
(
var
VariableDeclarationList ;
Expressionopt ;
Expressionopt )
Statementfor
(
LexicalDeclaration Expressionopt ;
Expressionopt )
StatementSee also: 13.1.5, 13.2.11, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.13.12, 13.15.5, 14.1.15, 14.2.12, 15.1.5, <IP_ADDRESS>.
for
(
Expressionopt ;
Expressionopt ;
Expressionopt )
Statementfor
(
var
VariableDeclarationList ;
Expressionopt ;
Expressionopt )
Statementfor
(
LexicalDeclaration Expressionopt ;
Expressionopt )
StatementSee also: 13.1.6, 13.2.12, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.13.13, 13.15.6, 14.1.16, 14.2.13, 15.1.6, <IP_ADDRESS>.
for
(
Expressionopt ;
Expressionopt ;
Expressionopt )
Statementfor
(
var
VariableDeclarationList ;
Expressionopt ;
Expressionopt )
Statementfor
(
LexicalDeclaration Expressionopt ;
Expressionopt )
StatementWith argument labelSet.
See also: 13.1.7, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.13.14.
for
(
Expressionopt ;
Expressionopt ;
Expressionopt )
Statementfor
(
var
VariableDeclarationList ;
Expressionopt ;
Expressionopt )
Statementfor
(
LexicalDeclaration Expressionopt ;
Expressionopt )
StatementThe abstract operation ForBodyEvaluation with arguments test, increment, stmt, perIterationBindings, and labelSet is performed as follows:
The abstract operation CreatePerIterationEnvironment with argument perIterationBindings is performed as follows:
for
-in
and
for
-of
Statementsfor
(
LeftHandSideExpression in
Expression )
Statementfor
(
LeftHandSideExpression of
AssignmentExpression )
StatementIt is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression cannot be parsed with no tokens left over using AssignmentPattern as the goal symbol.
If LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if the lexical token sequence matched by LeftHandSideExpression can be parsed with no tokens left over using AssignmentPattern as the goal symbol then the following rules are not applied. Instead, the Early Error rules for AssignmentPattern are used.
It is a Syntax Error if IsValidSimpleAssignmentTarget of LeftHandSideExpression is false.
It is a Syntax Error if the LeftHandSideExpression is CoverParenthesizedExpressionAndArrowParameterList :
(
Expression )
and Expression derives a production that would produce a Syntax Error according to these rules if that
production is substituted for LeftHandSideExpression. This rule is recursively applied.
NOTE The last rule means that the other rules are applied even if parentheses surround Expression.
for
(
ForDeclaration in
Expression )
Statementfor
(
ForDeclaration of
AssignmentExpression )
StatementIt is a Syntax Error if the BoundNames of ForDeclaration contains "let"
.
It is a Syntax Error if any element of the BoundNames of ForDeclaration also occurs in the VarDeclaredNames of Statement.
It is a Syntax Error if the BoundNames of ForDeclaration contains any duplicate entries.
See also: 12.1.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 14.1.3, 14.2.2, 14.4.2, 14.5.2, <IP_ADDRESS>, <IP_ADDRESS>.
With argument labelSet.
See also: 13.1.1, 13.2.2, 13.6.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.2, 13.12.2, 13.13.2, 13.15.2, <IP_ADDRESS>.
for
(
LeftHandSideExpression in
Expression )
Statementfor
(
var
ForBinding in
Expression )
Statementfor
(
ForDeclaration in
Expression )
Statementfor
(
LeftHandSideExpression of
AssignmentExpression )
Statementfor
(
var
ForBinding of
AssignmentExpression )
Statementfor
(
ForDeclaration of
AssignmentExpression )
StatementWith argument labelSet.
See also: 13.1.2, 13.2.3, 13.6.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.9.2, 13.11.3, 13.12.3, 13.13.3, 13.15.3, <IP_ADDRESS>.
for
(
LeftHandSideExpression in
Expression )
Statementfor
(
var
ForBinding in
Expression )
Statementfor
(
ForDeclaration in
Expression )
Statementfor
(
LeftHandSideExpression of
AssignmentExpression )
Statementfor
(
var
ForBinding of
AssignmentExpression )
Statementfor
(
ForDeclaration of
AssignmentExpression )
StatementWith arguments iterationSet and labelSet.
See also: 13.1.3, 13.2.4, 13.6.4, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.8.2, 13.11.4, 13.12.4, 13.13.4,13.15.4, <IP_ADDRESS>.
for
(
LeftHandSideExpression in
Expression )
Statementfor
(
var
ForBinding in
Expression )
Statementfor
(
ForDeclaration in
Expression )
Statementfor
(
LeftHandSideExpression of
AssignmentExpression )
Statementfor
(
var
ForBinding of
AssignmentExpression )
Statementfor
(
ForDeclaration of
AssignmentExpression )
StatementSee also: <IP_ADDRESS>.
See also: 13.1.5, 13.2.11, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.13.12, 13.15.5, 14.1.15, 14.2.12, 15.1.5, <IP_ADDRESS>.
for
(
LeftHandSideExpression in
Expression )
Statementfor
(
var
ForBinding in
Expression )
Statementfor
(
ForDeclaration in
Expression )
Statementfor
(
LeftHandSideExpression of
AssignmentExpression )
Statementfor
(
var
ForBinding of
AssignmentExpression )
Statementfor
(
ForDeclaration of
AssignmentExpression )
StatementSee also: 13.1.6, 13.2.12, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.13.13, 13.15.6, 14.1.16, 14.2.13, 15.1.6, <IP_ADDRESS>.
for
(
LeftHandSideExpression in
Expression )
Statementfor
(
var
ForBinding in
Expression )
Statementfor
(
ForDeclaration in
Expression )
Statementfor
(
LeftHandSideExpression of
AssignmentExpression )
Statementfor
(
var
ForBinding of
AssignmentExpression )
Statementfor
(
ForDeclaration of
AssignmentExpression )
StatementWith arguments value and environment.
NOTE undefined is passed for environment to indicate that a PutValue operation should be used to assign the initialization value. This is the case for
var
statements and the formal parameter lists of some non-strict functions (see 9.2.12). In those cases a lexical binding is hoisted and
preinitialized prior to evaluation of its initializer.
With argument environment.
With argument labelSet.
See also: 13.1.7, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.13.14.
for
(
LeftHandSideExpression in
Expression )
Statementfor
(
var
ForBinding in
Expression )
Statementfor
(
ForDeclaration in
Expression )
Statementfor
(
LeftHandSideExpression of
AssignmentExpression )
Statementfor
(
var
ForBinding of
AssignmentExpression )
Statementfor
(
ForDeclaration of
AssignmentExpression )
StatementThe abstract operation ForIn/OfHeadEvaluation is called with arguments TDZnames, expr, and iterationKind. The value of iterationKind is either enumerate or iterate.
The abstract operation ForIn/OfBodyEvaluation is called with arguments lhs, stmt, iterator, lhsKind, and labelSet. The value of lhsKind is either assignment, varBinding or lexicalBinding.
continue
Statementcontinue
;
continue
[no LineTerminator here] LabelIdentifier[?Yield] ;
ContinueStatement : continue
;
continue
LabelIdentifier ;
It is a Syntax Error if this production is not nested, directly or indirectly (but not crossing function boundaries), within an IterationStatement.
With arguments iterationSet and labelSet.
See also: 13.1.3, 13.2.4, 13.6.4, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.4, 13.12.4, 13.13.4,13.15.4, <IP_ADDRESS>.
continue
;
continue
LabelIdentifier ;
continue
;
continue
LabelIdentifier ;
break
Statementbreak
;
break
[no LineTerminator here] LabelIdentifier[?Yield] ;
break
;
It is a Syntax Error if this production is not nested, directly or indirectly (but not crossing function boundaries), within an IterationStatement or a SwitchStatement.
With argument labelSet.
See also: 13.1.2, 13.2.3, 13.6.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.3, 13.12.3, 13.13.3, 13.15.3, <IP_ADDRESS>.
break
;
break
LabelIdentifier ;
break
;
break
LabelIdentifier ;
return
Statementreturn
;
return
[no LineTerminator here] Expression[In, ?Yield] ;
NOTE A return
statement causes a function to cease execution and return a value to
the caller. If Expression is omitted, the return value is undefined. Otherwise, the return
value is the value of Expression.
return
;
return
Expression ;
with
Statementwith
(
Expression[In, ?Yield] )
Statement[?Yield, ?Return]NOTE The with
statement adds an object Environment Record for a computed object to the lexical environment of the running execution
context. It then executes a statement using this augmented lexical
environment. Finally, it restores the original lexical environment.
with
(
Expression )
StatementNOTE It is only necessary to apply the second rule if the extension specified in B.3.2 is implemented.
With argument labelSet.
See also: 13.1.1, 13.2.2, 13.6.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.12.2, 13.13.2, 13.15.2, <IP_ADDRESS>.
with
(
Expression )
StatementWith argument labelSet.
See also: 13.1.2, 13.2.3, 13.6.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.9.2, 13.12.3, 13.13.3, 13.15.3, <IP_ADDRESS>.
with
(
Expression )
StatementWith arguments iterationSet and labelSet.
See also: 13.1.3, 13.2.4, 13.6.4, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.8.2, 13.12.4, 13.13.4,13.15.4, <IP_ADDRESS>.
with
(
Expression )
StatementSee also: 13.1.5, 13.2.11, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.12.7, 13.13.12, 13.15.5, 14.1.15, 14.2.12, 15.1.5, <IP_ADDRESS>.
with
(
Expression )
StatementSee also: 13.1.6, 13.2.12, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.12.8, 13.13.13, 13.15.6, 14.1.16, 14.2.13, 15.1.6, <IP_ADDRESS>.
with
(
Expression )
Statementwith
(
Expression )
StatementNOTE No matter how control leaves the embedded Statement, whether normally or by some form of abrupt completion or exception, the LexicalEnvironment is always restored to its former state.
switch
Statementswitch
(
Expression[In, ?Yield] )
CaseBlock[?Yield, ?Return]{
CaseClauses[?Yield, ?Return]opt }
{
CaseClauses[?Yield, ?Return]opt DefaultClause[?Yield, ?Return] CaseClauses[?Yield, ?Return]opt }
case
Expression[In, ?Yield] :
StatementList[?Yield, ?Return]optdefault
:
StatementList[?Yield, ?Return]opt{
CaseClauses }
It is a Syntax Error if the LexicallyDeclaredNames of CaseClauses contains any duplicate entries.
It is a Syntax Error if any element of the LexicallyDeclaredNames of CaseClauses also occurs in the VarDeclaredNames of CaseClauses.
With argument labelSet.
See also: 13.1.1, 13.2.2, 13.6.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.2, 13.13.2, 13.15.2, <IP_ADDRESS>.
switch
(
Expression )
CaseBlock{
}
{
CaseClausesopt DefaultClause CaseClausesopt }
case
Expression :
StatementListoptdefault
:
StatementListoptWith argument labelSet.
See also: 13.1.2, 13.2.3, 13.6.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.9.2, 13.11.3, 13.13.3, 13.15.3, <IP_ADDRESS>.
switch
(
Expression )
CaseBlock{
}
{
CaseClausesopt DefaultClause CaseClausesopt }
case
Expression :
StatementListoptdefault
:
StatementListoptWith arguments iterationSet and labelSet.
See also: 13.1.3, 13.2.4, 13.6.4, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.8.2, 13.11.4, 13.13.4,13.15.4, <IP_ADDRESS>.
switch
(
Expression )
CaseBlock{
}
{
CaseClausesopt DefaultClause CaseClausesopt }
case
Expression :
StatementListoptdefault
:
StatementListoptSee also: 13.2.5, 13.13.6, 14.1.13, 14.2.10, 15.1.3, <IP_ADDRESS>.
{
}
{
CaseClausesopt DefaultClause CaseClausesopt }
case
Expression :
StatementListoptdefault
:
StatementListoptSee also: 13.2.6, 13.13.7, 14.1.14, 14.2.11, 15.1.4, <IP_ADDRESS>, <IP_ADDRESS>.
{
}
{
CaseClausesopt DefaultClause CaseClausesopt }
case
Expression :
StatementListoptdefault
:
StatementListoptSee also: 13.1.5, 13.2.11, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.13.12, 13.15.5, 14.1.15, 14.2.12, 15.1.5, <IP_ADDRESS>.
switch
(
Expression )
CaseBlock{
}
{
CaseClausesopt DefaultClause CaseClausesopt }
case
Expression :
StatementListoptdefault
:
StatementListoptSee also: 13.1.6, 13.2.12, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.13.13, 13.15.6, 14.1.16, 14.2.13, 15.1.6, <IP_ADDRESS>.
switch
(
Expression )
CaseBlock{
}
{
CaseClausesopt DefaultClause CaseClausesopt }
case
Expression :
StatementListoptdefault
:
StatementListoptWith argument input.
{
}
{
CaseClauses }
{
CaseClausesopt DefaultClause CaseClausesopt }
case
Expression :
StatementListoptNOTE CaseSelectorEvaluation does not execute the associated StatementList. It simply evaluates the Expression and returns the value, which the CaseBlock algorithm uses to determine which StatementList to start executing.
switch
(
Expression )
CaseBlockNOTE No matter how control leaves the SwitchStatement the LexicalEnvironment is always restored to its former state.
case
Expression :
case
Expression :
StatementListdefault
:
default
:
StatementList:
LabelledItem[?Yield, ?Return]NOTE A Statement may be prefixed by a label. Labelled statements are
only used in conjunction with labelled break
and continue
statements. ECMAScript has no
goto
statement. A Statement can be part of a LabelledStatement, which itself can be part of a LabelledStatement, and so on.
The labels introduced this way are collectively referred to as the “current label set” when describing the
semantics of individual statements. A LabelledStatement has no semantic meaning other than the
introduction of a label to a label set.
NOTE An alternative definition for this rule is provided in B.3.2.
With argument labelSet.
See also: 13.1.1, 13.2.2, 13.6.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.2, 13.12.2, 13.15.2, <IP_ADDRESS>.
:
LabelledItemWith argument labelSet.
See also: 13.1.2, 13.2.3, 13.6.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.9.2, 13.11.3, 13.12.3, 13.15.3, <IP_ADDRESS>.
:
LabelledItemWith arguments iterationSet and labelSet.
See also: 13.1.3, 13.2.4, 13.6.4, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.8.2, 13.11.4, 13.12.4, 13.15.4, <IP_ADDRESS>.
:
LabelledItemThe abstract operation IsLabelledFunction with argument stmt performs the following steps:
See also: 13.2.5, 13.12.5, 14.1.13, 14.2.10, 15.1.3, <IP_ADDRESS>.
:
LabelledItemSee also: 13.2.6, 13.12.6, 14.1.14, 14.2.11, 15.1.4, <IP_ADDRESS>, <IP_ADDRESS>.
:
LabelledItemSee also: 13.2.7.
:
LabelledItemSee also: 13.2.8.
:
LabelledItemSee also: 13.2.9.
:
LabelledItemSee also: 13.2.10.
:
LabelledItemSee also: 13.1.5, 13.2.11, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.15.5, 14.1.15, 14.2.12, 15.1.5, <IP_ADDRESS>.
:
LabelledItemSee also: 13.1.6, 13.2.12, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.15.6, 14.1.16, 14.2.13, 15.1.6, <IP_ADDRESS>.
:
LabelledItemWith argument labelSet.
See also: 13.1.7, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>.
:
LabelledItemLabelledItem : FunctionDeclaration
:
LabelledItemthrow
Statementthrow
[no LineTerminator here] Expression[In, ?Yield] ;
throw
Expression ;
try
Statementtry
Block[?Yield, ?Return] Catch[?Yield, ?Return]try
Block[?Yield, ?Return] Finally[?Yield, ?Return]try
Block[?Yield, ?Return] Catch[?Yield, ?Return] Finally[?Yield, ?Return]catch
(
CatchParameter[?Yield] )
Block[?Yield, ?Return]finally
Block[?Yield, ?Return]NOTE The try
statement encloses a block of code in which an exceptional condition
can occur, such as a runtime error or a throw
statement. The catch
clause provides the
exception-handling code. When a catch clause catches an exception, its CatchParameter is bound to
that exception.
catch
(
CatchParameter )
BlockIt is a Syntax Error if BoundNames of CatchParameter contains any duplicate elements.
It is a Syntax Error if any element of the BoundNames of CatchParameter also occurs in the LexicallyDeclaredNames of Block.
It is a Syntax Error if any element of the BoundNames of CatchParameter also occurs in the VarDeclaredNames of Block.
NOTE An alternative static semantics for this production is given in B.3.5.
With argument labelSet.
See also: 13.1.1, 13.2.2, 13.6.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.2, 13.12.2, 13.13.2, <IP_ADDRESS>.
try
Block Catchtry
Block Finallytry
Block Catch Finallycatch
(
CatchParameter )
BlockWith argument labelSet.
See also: 13.1.2, 13.2.3, 13.6.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.9.2, 13.11.3, 13.12.3, 13.13.3, <IP_ADDRESS>.
try
Block Catchtry
Block Finallytry
Block Catch Finallycatch
(
CatchParameter )
BlockWith arguments iterationSet and labelSet.
See also: 13.1.3, 13.2.4, 13.6.4, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.8.2, 13.11.4, 13.12.4, 13.13.4, <IP_ADDRESS>.
try
Block Catchtry
Block Finallytry
Block Catch Finallycatch
(
CatchParameter )
BlockSee also: 13.1.5, 13.2.11, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.13.12, 14.1.15, 14.2.12, 15.1.5, <IP_ADDRESS>.
try
Block Catchtry
Block Finallytry
Block Catch Finallycatch
(
CatchParameter )
BlockSee also: 13.1.6, 13.2.12, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.13.13, 14.1.16, 14.2.13, 15.1.6, <IP_ADDRESS>.
try
Block Catchtry
Block Finallytry
Block Catch Finallycatch
(
CatchParameter )
Blockwith parameter thrownValue
catch
(
CatchParameter )
BlockNOTE No matter how control leaves the Block the LexicalEnvironment is always restored to its former state.
try
Block Catchtry
Block Finallytry
Block Catch FinallyNOTE Evaluating the DebuggerStatement production may allow an implementation to cause a breakpoint when run under a debugger. If a debugger is not present or active this statement has no observable effect.
debugger
;
function
BindingIdentifier[?Yield] (
FormalParameters )
{
FunctionBody }
function
(
FormalParameters )
{
FunctionBody }
function
BindingIdentifieropt (
FormalParameters )
{
FunctionBody }
,
FunctionRestParameter[?Yield],
FormalParameter[?Yield]A Directive Prologue is the longest sequence of ExpressionStatement productions occurring as the initial StatementListItem or ModuleItem productions of a FunctionBody, a ScriptBody, or a ModuleBody and where each ExpressionStatement in the sequence consists entirely of a StringLiteral token followed by a semicolon. The semicolon may appear explicitly or may be inserted by automatic semicolon insertion. A Directive Prologue may be an empty sequence.
A Use Strict Directive is an ExpressionStatement in a Directive Prologue whose StringLiteral is either the exact code unit sequences "use
strict"
or
'use
strict'
. A Use Strict Directive may not contain an EscapeSequence or LineContinuation.
A Directive Prologue may contain more than one Use Strict Directive. However, an implementation may issue a warning if this occurs.
NOTE The ExpressionStatement productions of a Directive Prologue are evaluated normally during evaluation of the containing production. Implementations may define implementation specific meanings for ExpressionStatement productions which are not a Use Strict Directive and which occur in a Directive Prologue. If an appropriate notification mechanism exists, an implementation should issue a warning if it encounters in a Directive Prologue an ExpressionStatement that is not a Use Strict Directive and which does not have a meaning defined by the implementation.
FunctionDeclaration : function
BindingIdentifier (
FormalParameters )
{
FunctionBody }
FunctionDeclaration : function
(
FormalParameters )
{
FunctionBody }
FunctionExpression : function
BindingIdentifieropt (
FormalParameters )
{
FunctionBody
}
If the source code matching this production is strict code, the Early Error rules for StrictFormalParameters : FormalParameters are applied.
If the source code matching this production is strict code, it is a Syntax Error
if BindingIdentifier is the IdentifierName eval
or the
IdentifierName arguments
.
It is a Syntax Error if any element of the BoundNames of FormalParameters also occurs in the LexicallyDeclaredNames of FunctionBody.
It is a Syntax Error if FormalParameters Contains SuperProperty is true.
It is a Syntax Error if FunctionBody Contains SuperProperty is true.
It is a Syntax Error if FormalParameters Contains SuperCall is true.
It is a Syntax Error if FunctionBody Contains SuperCall is true.
NOTE 1 The LexicallyDeclaredNames of a FunctionBody does not include identifiers bound using var or function declarations.
It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements.
It is a Syntax Error if IsSimpleParameterList of FormalParameterList is false and BoundNames of FormalParameterList contains any duplicate elements.
NOTE 2 Multiple occurrences of the same BindingIdentifier in a FormalParameterList is only allowed for functions and generator functions which have simple parameter lists and which are not defined in strict mode code.
It is a Syntax Error if the LexicallyDeclaredNames of FunctionStatementList contains any duplicate entries.
It is a Syntax Error if any element of the LexicallyDeclaredNames of FunctionStatementList also occurs in the VarDeclaredNames of FunctionStatementList.
It is a Syntax Error if ContainsDuplicateLabels of FunctionStatementList with argument « » is true.
It is a Syntax Error if ContainsUndefinedBreakTarget of FunctionStatementList with argument « » is true.
It is a Syntax Error if ContainsUndefinedContinueTarget of FunctionStatementList with arguments « » and « » is true.
See also: 12.1.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 14.2.2, 14.4.2, 14.5.2, <IP_ADDRESS>, <IP_ADDRESS>.
function
BindingIdentifier (
FormalParameters )
{
FunctionBody }
function
(
FormalParameters )
{
FunctionBody }
"*default*"
».NOTE "*default*"
is used within this specification as a synthetic name for
hoistable anonymous functions that are defined using export declarations.
,
FunctionRestParameter,
FormalParameterWith parameter symbol.
See also: 5.3, <IP_ADDRESS>, <IP_ADDRESS>, 14.2.3, 14.4.4, 14.5.4
function
BindingIdentifier (
FormalParameters )
{
FunctionBody }
FunctionDeclaration : function
(
FormalParameters )
{
FunctionBody }
FunctionExpression : function
BindingIdentifieropt (
FormalParameters )
{
FunctionBody
}
NOTE Static semantic rules that depend upon substructure generally do not look into function definitions.
,
FunctionRestParameter,
FormalParameter,
FunctionRestParameterNOTE The ExpectedArgumentCount of a FormalParameterList is the number of FormalParameters to the left of either the rest parameter or the first FormalParameter with an Initializer. A FormalParameter without an initializer is allowed after the first parameter with an initializer but such parameters are considered to be optional with undefined as their default value.
,
FormalParameter,
FunctionRestParameter,
FormalParameterSee also: <IP_ADDRESS>, 14.2.7, 14.4.7, 14.5.6.
function
(
FormalParameters )
{
FunctionBody }
function
BindingIdentifier (
FormalParameters )
{
FunctionBody }
The abstract operation IsAnonymousFunctionDefinition determines if its argument is a function definition that does not bind a name. The argument production is the result of parsing an AssignmentExpression or Initializer. The following steps are taken:
See also: <IP_ADDRESS>, 14.4.8, 14.5.7, <IP_ADDRESS>.
FunctionDeclaration : function
BindingIdentifier (
FormalParameters )
{
FunctionBody }
FunctionDeclaration : function
(
FormalParameters )
{
FunctionBody }
See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.4.9, 14.5.8.
function
(
FormalParameters )
{
FunctionBody }
function
BindingIdentifier (
FormalParameters )
{
FunctionBody }
,
FunctionRestParameter,
FormalParameterSee also: 13.2.5, 13.12.5, 13.13.6, 14.2.10, 15.1.3, <IP_ADDRESS>.
See also: 13.2.6, 13.12.6, 13.13.7, 14.2.11, 15.1.4, <IP_ADDRESS>, <IP_ADDRESS>.
See also: 13.1.5, 13.2.11, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.13.12, 13.15.5, 14.2.12, 15.1.5, <IP_ADDRESS>.
See also: 13.1.6, 13.2.12, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.13.13, 13.15.6, 14.2.13, 15.1.6, <IP_ADDRESS>.
With parameter functionObject.
With parameters iteratorRecord and environment.
NOTE When undefined is passed for environment it indicates that a PutValue operation should be used to assign the initialization value. This is the case for formal parameter lists of non-strict functions. In that case the formal parameter bindings are preinitialized in order to deal with the possibility of multiple parameters with the same name.
,
FunctionRestParameter,
FormalParameterThe new Environment Record created in step 6 is only used if the BindElement’s Initializer contains a direct eval.
With parameter scope.
See also: 14.4.12.
function
BindingIdentifier (
FormalParameters )
{
FunctionBody }
function
(
FormalParameters )
{
FunctionBody }
"default"
).NOTE An anonymous FunctionDeclaration can only occur as part of an
export default
declaration.
function
BindingIdentifier (
FormalParameters )
{
FunctionBody }
NOTE 1 An alternative semantics is provided in B.3.3.
function
(
FormalParameters )
{
FunctionBody }
function
(
FormalParameters )
{
FunctionBody }
function
BindingIdentifier (
FormalParameters )
{
FunctionBody }
NOTE 2 The BindingIdentifier in a FunctionExpression can be referenced from inside the FunctionExpression's FunctionBody to allow the function to call itself recursively. However, unlike in a FunctionDeclaration, the BindingIdentifier in a FunctionExpression cannot be referenced from and does not affect the scope enclosing the FunctionExpression.
NOTE 3 A prototype
property is automatically created for every function defined
using a FunctionDeclaration or FunctionExpression, to allow for the
possibility that the function will be used as a constructor.
=>
ConciseBody[?In]{
FunctionBody }
When the production
ArrowParameters[Yield] : CoverParenthesizedExpressionAndArrowParameterList[?Yield]
is recognized the following grammar is used to refine the interpretation of CoverParenthesizedExpressionAndArrowParameterList :
(
StrictFormalParameters[?Yield] )
=>
ConciseBodyIt is a Syntax Error if ArrowParameters Contains YieldExpression is true.
It is a Syntax Error if ConciseBody Contains YieldExpression is true.
It is a Syntax Error if any element of the BoundNames of ArrowParameters also occurs in the LexicallyDeclaredNames of ConciseBody.
ArrowParameters[Yield] : CoverParenthesizedExpressionAndArrowParameterList[?Yield]
If the [Yield] grammar parameter is present on ArrowParameters, it is a Syntax Error if the lexical token sequence matched by CoverParenthesizedExpressionAndArrowParameterList[?Yield] cannot be parsed with no tokens left over using ArrowFormalParameters[Yield] as the goal symbol.
If the [Yield] grammar parameter is not present on ArrowParameters, it is a Syntax Error if the lexical token sequence matched by CoverParenthesizedExpressionAndArrowParameterList[?Yield] cannot be parsed with no tokens left over using ArrowFormalParameters as the goal symbol.
All early errors rules for ArrowFormalParameters and its derived productions also apply to CoveredFormalsList of CoverParenthesizedExpressionAndArrowParameterList[?Yield].
See also: 12.1.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 14.1.3, 14.4.2, 14.5.2, <IP_ADDRESS>, <IP_ADDRESS>.
With parameter symbol.
See also: 5.3, <IP_ADDRESS>, <IP_ADDRESS>, 14.1.4, 14.4.4, 14.5.4
=>
ConciseBodysuper
or
this
, return false.NOTE Normally, Contains does not look inside
most function forms However, Contains is used to detect
new.target
, this
, and super
usage within an ArrowFunction.
ArrowParameters : CoverParenthesizedExpressionAndArrowParameterList
See also: <IP_ADDRESS>, 14.1.8, 14.4.7, 14.5.6.
=>
ConciseBody(
Expression )
(
)
(
...
BindingIdentifier )
(
Expression ,
...
BindingIdentifier )
See also: 13.2.5, 13.12.5, 13.13.6, 14.1.13, 15.1.3, <IP_ADDRESS>.
See also: 13.2.6, 13.12.6, 13.13.7, 14.1.14, 15.1.4, <IP_ADDRESS>, <IP_ADDRESS>.
See also: 13.1.5, 13.2.11, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.13.12, 13.15.5, 14.1.15, 15.1.5, <IP_ADDRESS>.
See also: 13.1.6, 13.2.12, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.13.13, 13.15.6, 14.1.16, 15.1.6, <IP_ADDRESS>.
With parameters iteratorRecord and environment.
NOTE When undefined is passed for environment it indicates that a PutValue operation should be used to assign the initialization value. This is the case for formal parameter lists of non-strict functions. In that case the formal parameter bindings are preinitialized in order to deal with the possibility of multiple parameters with the same name.
With parameter functionObject.
=>
ConciseBodyNOTE An ArrowFunction does not define local bindings for
arguments
, super
, this
, or new.target
. Any reference to
arguments
, super
, this
, or new.target
within an ArrowFunction must resolve to a binding in a lexically enclosing environment. Typically this will be the
Function Environment of an immediately enclosing function. Even though an ArrowFunction may
contain references to super
, the function object created in step 4 is not made into a method by performing MakeMethod. An ArrowFunction that references super
is
always contained within a non-ArrowFunction and the necessary state to implement
super
is accessible via the scope that is captured by the function object of the ArrowFunction.
(
StrictFormalParameters )
{
FunctionBody }
get
PropertyName[?Yield] (
)
{
FunctionBody }
set
PropertyName[?Yield] (
PropertySetParameterList )
{
FunctionBody }
(
StrictFormalParameters )
{
FunctionBody }
It is a Syntax Error if any element of the BoundNames of StrictFormalParameters also occurs in the LexicallyDeclaredNames of FunctionBody.
set
PropertyName (
PropertySetParameterList )
{
FunctionBody }
It is a Syntax Error if BoundNames of PropertySetParameterList contains any duplicate elements.
It is a Syntax Error if any element of the BoundNames of PropertySetParameterList also occurs in the LexicallyDeclaredNames of FunctionBody.
With parameter symbol.
See also: <IP_ADDRESS>, 14.4.3, 14.5.5.
(
StrictFormalParameters )
{
FunctionBody }
get
PropertyName (
)
{
FunctionBody }
set
PropertyName (
PropertySetParameterList )
{
FunctionBody }
(
StrictFormalParameters )
{
FunctionBody }
get
PropertyName (
)
{
FunctionBody }
set
PropertyName (
PropertySetParameterList )
{
FunctionBody }
See also: 14.4.6.
(
StrictFormalParameters )
{
FunctionBody }
get
PropertyName (
)
{
FunctionBody }
set
PropertyName (
PropertySetParameterList )
{
FunctionBody }
See also: <IP_ADDRESS>, 14.4.10, 14.5.12
(
StrictFormalParameters )
{
FunctionBody }
get
PropertyName (
)
{
FunctionBody }
set
PropertyName (
PropertySetParameterList )
{
FunctionBody }
(
StrictFormalParameters )
{
FunctionBody }
get
PropertyName (
)
{
FunctionBody }
set
PropertyName (
PropertySetParameterList )
{
FunctionBody }
With parameters object and optional parameter functionPrototype.
(
StrictFormalParameters )
{
FunctionBody }
With parameters object and enumerable.
See also: <IP_ADDRESS>, 14.4.13, B.3.1
(
StrictFormalParameters )
{
FunctionBody }
See 14.4.
get
PropertyName (
)
{
FunctionBody }
"get"
).set
PropertyName (
PropertySetParameterList )
{
FunctionBody }
"set"
).*
PropertyName[?Yield] (
StrictFormalParameters[Yield] )
{
GeneratorBody }
function
*
BindingIdentifier[?Yield] (
FormalParameters[Yield] )
{
GeneratorBody }
function
*
(
FormalParameters[Yield] )
{
GeneratorBody }
function
*
BindingIdentifier[Yield]opt (
FormalParameters[Yield] )
{
GeneratorBody }
yield
yield
[no LineTerminator here] AssignmentExpression[?In, Yield]yield
[no LineTerminator here] *
AssignmentExpression[?In, Yield]NOTE 1 The syntactic context immediately following yield
requires use of the InputElementRegExpOrTemplateTail lexical goal.
NOTE 2 YieldExpression cannot be used within the FormalParameters of a generator function because any expressions that are part of FormalParameters are evaluated before the resulting generator object is in a resumable state.
NOTE 3 Abstract operations relating to generator objects are defined in 25.3.3.
*
PropertyName (
StrictFormalParameters )
{
GeneratorBody }
It is a Syntax Error if HasDirectSuper of GeneratorMethod is true.
It is a Syntax Error if StrictFormalParameters Contains YieldExpression is true.
It is a Syntax Error if any element of the BoundNames of StrictFormalParameters also occurs in the LexicallyDeclaredNames of GeneratorBody.
function
*
BindingIdentifier (
FormalParameters )
{
GeneratorBody }
function
*
BindingIdentifieropt (
FormalParameters )
{
GeneratorBody }
GeneratorDeclaration : function
*
BindingIdentifier (
FormalParameters )
{
GeneratorBody
}
GeneratorExpression :
function
*
BindingIdentifieropt (
FormalParameters )
{
GeneratorBody }
If the source code matching this production is strict code, the Early Error rules for StrictFormalParameters : FormalParameters are applied.
If the source code matching this production is strict code, it is a Syntax Error
if BindingIdentifier is the IdentifierName eval
or the
IdentifierName arguments
.
It is a Syntax Error if any element of the BoundNames of FormalParameters also occurs in the LexicallyDeclaredNames of GeneratorBody.
It is a Syntax Error if FormalParameters Contains YieldExpression is true.
It is a Syntax Error if FormalParameters Contains SuperProperty is true.
It is a Syntax Error if GeneratorBody Contains SuperProperty is true.
See also: 12.1.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 14.1.3, 14.2.2, 14.5.2, <IP_ADDRESS>, <IP_ADDRESS>.
function
*
BindingIdentifier (
FormalParameters )
{
GeneratorBody }
function
*
(
FormalParameters )
{
GeneratorBody }
"*default*"
».NOTE "*default*"
is used within this specification as a synthetic name for
hoistable anonymous functions that are defined using export declarations.
With parameter symbol.
See also: <IP_ADDRESS>, 14.3.2, 14.5.5.
*
PropertyName (
StrictFormalParameters )
{
GeneratorBody }
With parameter symbol.
See also: 5.3, <IP_ADDRESS>, <IP_ADDRESS>, 14.1.4, 14.2.3, 14.5.4
GeneratorDeclaration : function
*
BindingIdentifier (
FormalParameters )
{
GeneratorBody
}GeneratorDeclaration
:
function
*
(
FormalParameters )
{
GeneratorBody }
function
*
BindingIdentifieropt (
FormalParameters )
{
GeneratorBody }
NOTE Static semantic rules that depend upon substructure generally do not look into function definitions.
*
PropertyName (
StrictFormalParameters )
{
GeneratorBody }
See also: 14.3.5.
*
PropertyName (
StrictFormalParameters )
{
GeneratorBody }
GeneratorDeclaration : function
*
BindingIdentifier (
FormalParameters )
{
GeneratorBody
}
GeneratorDeclaration :
function
*
(
FormalParameters )
{
GeneratorBody }
GeneratorExpression : function
*
(
FormalParameters )
{
GeneratorBody }
GeneratorExpression : function
*
BindingIdentifier (
FormalParameters )
{
GeneratorBody }
See also: <IP_ADDRESS>, 14.1.8, 14.2.7, 14.5.6.
function
*
(
FormalParameters )
{
GeneratorBody }
function
*
BindingIdentifier (
FormalParameters )
{
GeneratorBody }
See also: <IP_ADDRESS>, 14.1.10, 14.5.7, <IP_ADDRESS>.
GeneratorDeclaration : function
*
BindingIdentifier (
FormalParameters )
{
GeneratorBody
}GeneratorDeclaration
:
function
*
(
FormalParameters )
{
GeneratorBody }
See also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.5.8.
function
*
(
FormalParameters )
{
GeneratorBody }
function
*
BindingIdentifier (
FormalParameters )
{
GeneratorBody }
See also: <IP_ADDRESS>, 14.3.6, 14.5.12
*
PropertyName (
StrictFormalParameters )
{
GeneratorBody }
With parameter functionObject.
"%GeneratorPrototype%"
, «[[GeneratorState]], [[GeneratorContext]]» ).NOTE If the generator was invoked using [[Call]], the this
binding will have
already been initialized in the normal manner. If the generator was invoked using [[Construct]], the this
bind is not initialized and any references to this
within the FunctionBody will
produce a ReferenceError exception.
With parameter scope.
See also: 14.1.19.
function
*
BindingIdentifier (
FormalParameters )
{
GeneratorBody }
function
*
(
FormalParameters )
{
GeneratorBody }
"default"
).NOTE An anonymous GeneratorDeclaration can only occur as part of an
export default
declaration.
With parameter object and enumerable.
See also: <IP_ADDRESS>, 14.3.9, B.3.1
*
PropertyName (
StrictFormalParameters )
{
GeneratorBody }
function
*
(
FormalParameters )
{
GeneratorBody }
function
*
BindingIdentifier (
FormalParameters )
{
GeneratorBody }
NOTE The BindingIdentifier in a GeneratorExpression can be referenced from inside the GeneratorExpression's FunctionBody to allow the generator code to call itself recursively. However, unlike in a GeneratorDeclaration, the BindingIdentifier in a GeneratorExpression cannot be referenced from and does not affect the scope enclosing the GeneratorExpression.
yield
yield
AssignmentExpressionyield
*
AssignmentExpression"throw"
).throw
method are propagated. Normal completions
from an inner throw
method are processed similarly to an inner next
.throw
method, this throw is going to terminate
the yield*
loop. But first we need to give iterator a chance to clean up.yield*
protocol violation: iterator does not have a throw
method."return"
).class
BindingIdentifier[?Yield] ClassTail[?Yield]class
ClassTail[?Yield]class
BindingIdentifier[?Yield]opt ClassTail[?Yield]{
ClassBody[?Yield]opt }
extends
LeftHandSideExpression[?Yield]static
MethodDefinition[?Yield];
NOTE A ClassBody is always strict code.
{
ClassBody }
It is a Syntax Error if ClassHeritage is not present and the following algorithm evaluates to true:
It is a Syntax Error if PrototypePropertyNameList of ClassElementList contains more than one occurrence of "constructor"
.
It is a Syntax Error if PropName of MethodDefinition is not "constructor"
and HasDirectSuper of MethodDefinition is true.
It is a Syntax Error if PropName of MethodDefinition is "constructor"
and SpecialMethod of MethodDefinition is true.
static
MethodDefinition"prototype"
.See also: 12.1.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 14.1.3, 14.2.2, 14.4.2, <IP_ADDRESS>, <IP_ADDRESS>.
class
BindingIdentifier ClassTailclass
ClassTail"*default*"
».;
, return empty."constructor"
, return empty.;
, return empty."constructor"
, return empty.NOTE Early Error rules ensure that there is only one method definition named
"constructor"
and that it is not an accessor property or generator definition.
With parameter symbol.
See also: 5.3, <IP_ADDRESS>, <IP_ADDRESS>, 14.1.4, 14.2.3, 14.4.4
{
ClassBody }
NOTE Static semantic rules that depend upon substructure generally do not look into class bodies except for PropertyName productions.
With parameter symbol.
See also: <IP_ADDRESS>, 14.3.2, 14.4.3.
static
MethodDefinition;
See also: <IP_ADDRESS>, 14.1.8, 14.2.7, 14.4.7.
class
ClassTailclass
BindingIdentifier ClassTailSee also: <IP_ADDRESS>, 14.1.10, 14.4.8, <IP_ADDRESS>.
ClassDeclaration : class
BindingIdentifier ClassTail
class
ClassTailSee also: <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 12.4.2, 12.5.2, 12.6.1, 12.7.1, 12.8.1, 12.9.1, 12.10.1, 12.11.1, 12.12.1, 12.13.1, 12.14.2, 12.15.1, 14.1.11, 14.4.9.
class
ClassTailclass
BindingIdentifier ClassTailstatic
MethodDefinition;
;
, return a new empty List."constructor"
,
return a new empty List.;
, return list."constructor"
,
return list.See also: <IP_ADDRESS>, 14.3.6, 14.4.10
;
With parameter className.
{
ClassBodyopt }
"generator"
, throw a TypeError exception."prototype"
).constructor(... args){ super
(...args);}
using
the syntactic grammar with the goal symbol MethodDefinition.constructor(
){ }
using the syntactic grammar with the goal symbol MethodDefinition."derived"
."constructor"
,
F).class
BindingIdentifier ClassTail"name"
).class
ClassTailNOTE ClassDeclaration :
class
ClassTail only occurs as part of an ExportDeclaration and the setting of a name property and establishing its binding are handled as part
of the evaluation action for that production. See <IP_ADDRESS>.
class
BindingIdentifier ClassTailNOTE 1 ClassDeclaration :
class
ClassTail only occurs as part of an ExportDeclaration and is never directly evaluated.
class
BindingIdentifieropt ClassTail"name"
).NOTE 2 If the class definition included a name
static method then that method is
not over-written with a name
data property for the class name.
The abstract operation IsInTailPosition with argument nonterminal performs the following steps:
NOTE Tail Position calls are only defined in strict mode code because of a common non-standard language extension (see 9.2.7) that enables observation of the chain of caller contexts.
With parameter nonterminal.
NOTE nonterminal is a parsed grammar production that represent a specific range of source text. When the following algorithms compare nonterminal to other grammar symbols they are testing whether the same source text was matched by both symbols.
FunctionStatementList : [empty]
StatementListItem : Declaration
:
{
}
:
return
;
:
FunctionDeclarationfor
(
LeftHandSideExpression in
Expression )
Statementfor
(
var
ForBinding in
Expression )
Statementfor
(
ForDeclaration in
Expression )
Statementfor
(
LeftHandSideExpression of
AssignmentExpression )
Statementfor
(
var
ForBinding of
AssignmentExpression )
Statementfor
(
ForDeclaration of
AssignmentExpression )
Statement:
{
}
if
(
Expression )
Statement else
StatementIfStatement : if
(
Expression )
Statement
do
Statement while
(
Expression )
;
while
(
Expression )
Statementfor
(
Expressionopt ;
Expressionopt ;
Expressionopt )
Statementfor
(
var
VariableDeclarationList ;
Expressionopt ;
Expressionopt )
Statementfor
(
LexicalDeclaration Expressionopt ;
Expressionopt )
Statement:
with
(
Expression )
Statement:
LabelledItemreturn
Expression ;
switch
(
Expression )
CaseBlock{
CaseClausesopt DefaultClause CaseClausesopt }
CaseClause : case
Expression :
StatementListopt
default
:
StatementListopttry
Block CatchTryStatement : try
Block Finally
try
Block Catch Finallycatch
(
CatchParameter )
BlockNOTE A potential tail position call that is immediately followed by return GetValue of the call result is also a possible tail position call. Function calls cannot return reference values, so such a GetValue operation will always returns the same value as the actual function call result.
=
AssignmentExpression:
BitwiseANDExpression &
EqualityExpression:
BitwiseXORExpression ^
BitwiseANDExpression:
BitwiseORExpression |
BitwiseXORExpression==
RelationalExpression!=
RelationalExpression===
RelationalExpression!==
RelationalExpression<
ShiftExpression>
ShiftExpression<=
ShiftExpression>=
ShiftExpressioninstanceof
ShiftExpressionin
ShiftExpression<<
AdditiveExpression>>
AdditiveExpression>>>
AdditiveExpression+
MultiplicativeExpression-
MultiplicativeExpressiondelete
UnaryExpressionvoid
UnaryExpressiontypeof
UnaryExpression++
UnaryExpression--
UnaryExpression+
UnaryExpression-
UnaryExpression~
UnaryExpression!
UnaryExpression++
--
[
Expression ]
.
IdentifierName:
new
NewExpression[
Expression ]
.
IdentifierNamenew
MemberExpression Argumentsthis
,
AssignmentExpression?
AssignmentExpression :
AssignmentExpression&&
BitwiseORExpression||
LogicalANDExpression(
Expression )
The abstract operation PrepareForTailCall performs the following steps:
A tail position call must either release any transient internal resources associated with the currently executing function execution context before invoking the target function or reuse those resources in support of the target function.
NOTE For example, a tail position call should only grow an implementation’s activation record stack by the amount that the size of the target function’s activation record exceeds the size of the calling function’s activation record. If the target function’s activation record is smaller, then the total size of the stack should decrease.
It is a Syntax Error if the LexicallyDeclaredNames of ScriptBody contains any duplicate entries.
It is a Syntax Error if any element of the LexicallyDeclaredNames of ScriptBody also occurs in the VarDeclaredNames of ScriptBody.
It is a Syntax Error if StatementList Contains super
unless the source code containing super
is eval code that is
being processed by a direct eval
that is contained in function code that is not the function code of an
ArrowFunction.
It is a Syntax Error if StatementList Contains NewTarget unless the source code containing NewTarget is eval code that is being processed by a direct eval
that is contained in
function code that is not the function code of an ArrowFunction.
It is a Syntax Error if ContainsDuplicateLabels of StatementList with argument « » is true.
It is a Syntax Error if ContainsUndefinedBreakTarget of StatementList with argument « » is true.
It is a Syntax Error if ContainsUndefinedContinueTarget of StatementList with arguments « » and « » is true.
See also: 13.2.5, 13.12.5, 13.13.6, 14.1.13, 14.2.10, <IP_ADDRESS>.
NOTE At the top level of a Script, function declarations are treated like var declarations rather than like lexical declarations.
See also: 13.2.6, 13.12.6, 13.13.7, 14.1.14, 14.2.11, <IP_ADDRESS>, <IP_ADDRESS>.
See also: 13.1.5, 13.2.11, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.13.12, 13.15.5, 14.1.15, 14.2.12, <IP_ADDRESS>.
See also: 13.1.6, 13.2.12, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.13.13, 13.15.6, 14.1.16, 14.2.13, <IP_ADDRESS>.
With argument realm.
NOTE 1 When an execution context is established for evaluating scripts, declarations are instantiated in the current global environment. Each global binding declared in the code is instantiated.
GlobalDeclarationInstantiation is performed as follows using arguments script and env. script is the ScriptBody for which the execution context is being established. env is the global lexical environment in which bindings are to be created.
NOTE 2 Early errors specified in 15.1.1 prevent name conflicts between function/var declarations and let/const/class declarations as well as redeclaration of let/const/class bindings for declaration contained within a single Script. However, such conflicts and redeclarations that span more than one Script are detected as runtime errors during GlobalDeclarationInstantiation. If any such errors are detected, no bindings are instantiated for the script. However, if the global object is defined using Proxy exotic objects then the runtime tests for conflicting declarations may be unreliable resulting in an abrupt completion and some global declarations not being instantiated. If this occurs, the code for the Script is not evaluated.
Unlike explicit var or function declarations, properties that are directly created on the global object result in global bindings that may be shadowed by let/const/class declarations.
The job ScriptEvaluationJob with parameter sourceText parses, validates, and evaluates sourceText as a Script.
NOTE An implementation may parse a sourceText as a Script and analyze it for Early Error conditions prior to the execution of the ScriptEvaluationJob for that sourceText. However, the reporting of any errors must be deferred until the ScriptEvaluationJob is actually executed.
It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList contains any duplicate entries.
It is a Syntax Error if any element of the LexicallyDeclaredNames of ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
It is a Syntax Error if the ExportedNames of ModuleItemList contains any duplicate entries.
It is a Syntax Error if any element of the ExportedBindings of ModuleItemList does not also occur in either the VarDeclaredNames of ModuleItemList, or the LexicallyDeclaredNames of ModuleItemList.
It is a Syntax Error if ModuleItemList Contains super
.
It is a Syntax Error if ModuleItemList Contains NewTarget
It is a Syntax Error if ContainsDuplicateLabels of ModuleItemList with argument « » is true.
It is a Syntax Error if ContainsUndefinedBreakTarget of ModuleItemList with argument « » is true.
It is a Syntax Error if ContainsUndefinedContinueTarget of ModuleItemList with arguments « » and « » is true.
NOTE The duplicate ExportedNames rule implies that multiple export default
ExportDeclaration items within a ModuleBody is a Syntax Error. Additional
error conditions relating to conflicting or duplicate declarations are checked during module linking prior to evaluation
of a Module. If any such errors are detected the Module is not
evaluated.
With argument labelSet.
See also: 13.1.1, 13.2.2, 13.6.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.2, 13.12.2, 13.13.2, 13.15.2.
With argument labelSet.
See also: 13.1.2, 13.2.3, 13.6.3, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.9.2, 13.11.3, 13.12.3, 13.13.3, 13.15.3.
With arguments iterationSet and labelSet.
See also: 13.1.3, 13.2.4, 13.6.4, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.8.2, 13.11.4, 13.12.4, 13.13.4, 13.15.4.
See also: <IP_ADDRESS>.
NOTE ExportedBindings are the locally bound names that are explicitly associated with a Module’s ExportedNames.
See also: <IP_ADDRESS>.
NOTE ExportedNames are the externally visible names that a Module explicitly maps to one of its local name bindings.
See also: <IP_ADDRESS>.
See also: <IP_ADDRESS>.
The abstract operation ImportedLocalNames with argument importEntries creates a List of all of the local name bindings defined by a List of ImportEntry Records (see Table 39). ImportedLocalNames performs the following steps:
See also: 13.2.5, 13.12.5, 13.13.6, 14.1.13, 14.2.10, 15.1.3.
NOTE 1 The LexicallyDeclaredNames of a Module includes the names of all of its imported bindings.
export
VariableStatement, return a new empty List.NOTE 2 At the top level of a Module, function declarations are treated like lexical declarations rather than like var declarations.
See also: 13.2.6, 13.12.6, 13.13.7, 14.1.14, 14.2.11, 15.1.4, <IP_ADDRESS>.
See also: 13.1.5, 13.2.11, <IP_ADDRESS>, 13.6.5, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.5, 13.12.7, 13.13.12, 13.15.5, 14.1.15, 14.2.12, 15.1.5.
ModuleItemList : ModuleItemList ModuleItem
export
VariableStatement, return BoundNames of
ExportDeclaration.See also: 13.1.6, 13.2.12, <IP_ADDRESS>, 13.6.6, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 13.11.6, 13.12.8, 13.13.13, 13.15.6, 14.1.16, 14.2.13, 15.1.6.
export
VariableStatement, return VarScopedDeclarations of
VariableStatement.A Module Record encapsulates structural information about the imports and exports of a single module. This information is used to link the imports and exports of sets of connected modules. A Module Record includes four fields that are only used when evaluating a module.
For specification purposes Module Record values are values of the Record specification type and can be thought of as existing in a simple object-oriented hierarchy where Module Record is an abstract class with concrete subclasses. This specification only defines a single Module Record concrete subclass named Source Text Module Record. Other specifications and implementations may define additional Module Record subclasses corresponding to alternative module definition facilities that they defined.
Module Record defines the fields listed in Table 36. All Module Definition subclasses include at least those fields. Module Record also defines the abstract method list in Table 37. All Module definition subclasses must provide concrete implementations of these abstract methods.
| Field Name | Value Type | Meaning |
|---|---|---|
| [[Realm]] | Realm Record | undefined | The Realm within which this module was created. undefined if not yet assigned. |
| [[Environment]] | Lexical Environment | undefined | The Lexical Environment containing the top level bindings for this module. This field is set when the module is instantiated. |
| [[Namespace]] | Object | undefined | The Module Namespace Object (26.3) if one has been created for this module. Otherwise undefined. |
| [[Evaluated]] | Boolean | Initially false, true if evaluation of this module has started. Remains true when evaluation completes, even if it is an abrupt completion. |
| Method | Purpose |
|---|---|
| GetExportedNames(exportStarSet) | Return a list of all names that are either directly or indirectly exported from this module. |
| ResolveExport(exportName, resolveSet, exportStarSet) | Return the binding of a name exported by this modules. Bindings are represented by a Record of the form {[[module]]: Module Record, [[bindingName]]: String} |
| ModuleDeclarationInstantiation() | Transitively resolve all module dependencies and create a module Environment Record for the module. |
| ModuleEvaluation() |
Do nothing if this module has already been evaluated. Otherwise, transitively evaluate all module dependences of this module and then evaluate this module. ModuleDeclarationInstantiation must be completed prior to invoking this method. |
A Source Text Module Record is used to represent information about a module that was defined from ECMAScript source text (10) that was parsed using the goal symbol Module. Its fields contain digested information about the names that are imported by the module and its concrete methods use this digest to link, instantiate, and evaluate the module.
In addition to the fields, defined in Table 36, Source Text Module Records have the additional fields listed in Table 38. Each of these fields initially has the value undefined.
| Field Name | Value Type | Meaning |
|---|---|---|
| [[ECMAScriptCode]] | a parse result | The result of parsing the source text of this module using Module as the goal symbol. |
| [[RequestedModules]] | List of String | A List of all the ModuleSpecifier strings used by the module represented by this record to request the importation of a module. The List is source code occurrence ordered. |
| [[ImportEntries]] | List of ImportEntry Records | A List of ImportEntry records derived from the code of this module. |
| [[LocalExportEntries]] | List of ExportEntry Records | A List of ExportEntry records derived from the code of this module that correspond to declarations that occur within the module. |
| [[IndirectExportEntries]] | List of ExportEntry Records | A List of ExportEntry records derived from the code of this module that correspond to reexported imports that occur within the module. |
| [[StarExportEntries]] | List of ExportEntry Records | A List of ExportEntry records derived from the code of this module that correspond to export * declarations that occur within the module. |
An ImportEntry Record is a Record that digests information about a single declarative import. Each ImportEntry Record has the fields defined in Table 39:
| Field Name | Value Type | Meaning |
|---|---|---|
| [[ModuleRequest]] | String | String value of the ModuleSpecifier of the ImportDeclaration. |
| [[ImportName]] | String | The name under which the desired binding is exported by the module identified by [[ModuleRequest]]. The value "*" indicates that the import request is for the target module’s namespace object. |
| [[LocalName]] | String | The name that is used to locally access the imported value from within the importing module. |
NOTE 1 Table 40 gives examples of ImportEntry records fields used to represent the syntactic import forms:
|
Import Statement Form |
[[ModuleRequest]] |
[[ImportName]] |
[[LocalName]] |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
An ImportEntry Record is not created. |
An ExportEntry Record is a Record that digests information about a single declarative export. Each ExportEntry Record has the fields defined in Table 41:
| Field Name | Value Type | Meaning |
|---|---|---|
| [[ExportName]] | String | The name used to export this binding by this module. |
| [[ModuleRequest]] | String | null | The String value of the ModuleSpecifier of the ExportDeclaration. null if the ExportDeclaration does not have a ModuleSpecifier. |
| [[ImportName]] | String | null | The name under which the desired binding is exported by the module identified by [[ModuleRequest]]. null if the ExportDeclaration does not have a ModuleSpecifier. "*" indicates that the export request is for all exported bindings. |
| [[LocalName]] | String | null | The name that is used to locally access the exported value from within the importing module. null if the exported value is not locally accessible from within the module. |
NOTE 2 Table 42 gives examples of the ExportEntry record fields used to represent the syntactic export forms:
|
Export Statement Form |
[[ExportName]] |
[[ModuleRequest]] |
[[ImportName]] |
[[LocalName]] |
|---|---|---|---|---|
|
|
|
null |
null |
|
|
|
|
null |
null |
|
|
|
|
null |
null |
|
|
|
|
null |
null |
|
|
|
|
null |
null |
|
|
|
|
null |
null |
|
|
|
|
|
|
null |
|
|
|
|
|
null |
|
|
null |
|
|
null |
The following definitions specify the required concrete methods and other abstract operations for Source Text Module Records
The abstract operation ParseModule with argument sourceText creates a Source Text Module Record based upon the result of parsing sourceText as a Module. ParseModule performs the following steps:
"*"
, then
"*"
, then
NOTE An implementation may parse module source text and analyze it for Early Error conditions prior to the evaluation of ParseModule for that module source text. However, the reporting of any errors must be deferred until the point where this specification actually performs ParseModule upon that source text.
The GetExportedNames concrete method of a Source Text Module Record with argument exportStarSet performs the following steps:
"default"
) is false, then
NOTE GetExportedNames does not filter out or throw an exception for names that have ambiguous star export bindings.
The ResolveExport concrete method of a Source Text Module Record with arguments exportName, resolveSet, and exportStarSet performs the following steps:
"default"
) is true, then
default
export was not explicitly defined by
this module.default
export cannot be provided by an export *
."ambiguous"
, return "ambiguous"
."ambiguous"
.NOTE ResolveExport attempts to resolve an imported binding to the actual defining module and local binding name. The defining module may be the module represented by the Module Record this method was invoked on or some other module that is imported by that module. The parameter resolveSet is use to detect unresolved circular import/export paths. If a pair consisting of specific Module Record and exportName is reached that is already in resolveSet, an import circularity has been encountered. Before recursively calling ResolveExport, a pair consisting of module and exportName is added to resolveSet.
If a defining module is found a Record {[[module]], [[bindingName]]} is returned. This record identifies the
resolved binding of the originally requested export. If no definition was found or the request is found to be
circular, null is returned. If the request is found to be ambiguous, the string
"ambiguous"
is returned.
The ModuleDeclarationInstantiation concrete method of a Source Text Module Record performs the following steps:
"ambiguous"
, throw a
SyntaxError exception."*"
, then
"ambiguous"
, throw a
SyntaxError exception.The ModuleEvaluation concrete method of a Source Text Module Record performs the following steps:
HostResolveImportedModule is an implementation defined abstract operation that provides the concrete Module Record subclass instance that corresponds to the ModuleSpecifier String, specifier, occurring within the context of the module represented by the Module Record referencingModule.
The implementation of HostResolveImportedModule must conform to the following requirements:
The normal return value must be an instance of a concrete subclass of Module Record.
If a Module Record corresponding to the pair referencingModule, specifier does not exist or cannot be created, an exception must be thrown.
This operation must be idempotent if it completes normally. Each time it is called with a specific referencingModule, specifier pair as arguments it must return the same Module Record instance.
Multiple different referencingModule, specifier pairs may map to the same Module Record instance. The actual mapping semantic is implementation defined but typically a normalization process is applied to specifier as part of the mapping process. A typical normalization process would include actions such as alphabetic case folding and expansion of relative and abbreviated path specifiers.
The abstract operation GetModuleNamespace called with argument module performs the following steps:
"ambiguous"
, append name to unambiguousNames.A TopLevelModuleEvaluationJob with parameter sourceText is a job that parses, validates, and evaluates sourceText as a Module.
NOTE An implementation may parse a sourceText as a Module, analyze it for Early Error conditions, and instantiate it prior to the execution of the TopLevelModuleEvaluationJob for that sourceText. An implementation may also resolve, pre-parse and pre-analyze, and pre-instantiate module dependencies of sourceText. However, the reporting of any errors detected by these actions must be deferred until the TopLevelModuleEvaluationJob is actually executed.
NOTE The value of a ModuleItemList is the value of the last value producing item in the ModuleItemList.
import
ImportClause FromClause ;
import
ModuleSpecifier ;
,
NameSpaceImport,
NamedImports*
as
ImportedBinding{
}
{
ImportsList }
{
ImportsList ,
}
from
ModuleSpecifier,
ImportSpecifieras
ImportedBindingIt is a Syntax Error if the BoundNames of ImportDeclaration contains any duplicate entries.
See also: 12.1.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 14.1.3, 14.2.2, 14.4.2, 14.5.2, <IP_ADDRESS>.
import
ImportClause FromClause ;
import
ModuleSpecifier ;
,
NameSpaceImport,
NamedImports{
}
,
ImportSpecifieras
ImportedBindingSee also: <IP_ADDRESS>.
import
ImportClause FromClause ;
import
ModuleSpecifier ;
With parameter module.
,
NameSpaceImport,
NamedImportsImportedDefaultBinding : ImportedBinding
"default"
,
[[LocalName]]: localName }.*
as
ImportedBinding"*"
, [[LocalName]]:
localName }.{
}
,
ImportSpecifieras
ImportedBindingimport
ImportClause FromClause ;
export
*
FromClause ;
export
ExportClause FromClause ;
export
ExportClause ;
export
VariableStatementexport
Declarationexport
default
HoistableDeclaration[Default]export
default
ClassDeclaration[Default]export
default
[lookahead ∉ {function
, class
}] AssignmentExpression[In] ;
{
}
{
ExportsList }
{
ExportsList ,
}
,
ExportSpecifieras
IdentifierNameexport
ExportClause ;
For each IdentifierName n in ReferencedBindings of ExportClause : It is
a
Syntax Error if
StringValue of
n is a ReservedWord
or if the StringValue of n is one of: "implements"
, "interface"
,
"let"
, "package"
, "private"
, "protected"
, "public"
,
"static"
, or "yield"
.
NOTE The above rule means that each ReferencedBindings of ExportClause is treated as an IdentifierReference.
See also: 12.1.2, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, <IP_ADDRESS>, 14.1.3, 14.2.2, 14.4.2, 14.5.2, <IP_ADDRESS>.
export
*
FromClause ;
export
ExportClause FromClause ;
export
ExportClause ;
export
VariableStatementexport
Declarationexport
default
HoistableDeclaration"*default*"
, append "*default*"
to
declarationNames.export
default
ClassDeclaration"*default*"
, append "*default*"
to
declarationNames.ExportDeclaration : export default
AssignmentExpression
;
"*default*"
».See also: <IP_ADDRESS>.
export
ExportClause FromClause ;
export
*
FromClause ;
export
ExportClause ;
export
VariableStatementexport
DeclarationExportDeclaration : export
default
HoistableDeclaration
ExportDeclaration : export
default
ClassDeclaration
ExportDeclaration : export
default
AssignmentExpression ;
{
}
,
ExportSpecifieras
IdentifierNameSee also: <IP_ADDRESS>.
export
*
FromClause ;
export
ExportClause FromClause ;
export
ExportClause ;
export
VariableStatementexport
DeclarationExportDeclaration : export
default
HoistableDeclaration
ExportDeclaration : export
default
ClassDeclaration
ExportDeclaration : export
default
AssignmentExpression ;
"default"
».{
}
,
ExportSpecifieras
IdentifierNameSee also: <IP_ADDRESS>.
export
*
FromClause ;
"*"
, [[LocalName]]:
null, [[ExportName]]: null }.export
ExportClause FromClause ;
export
ExportClause ;
export
VariableStatementexport
Declarationexport
default
HoistableDeclaration"default"
}.export
default
ClassDeclaration"default"
}.ExportDeclaration : export default
AssignmentExpression;
"*default*"
, [[ExportName]]: "default"
}.NOTE "*default*"
is used within this specification as a synthetic name for
anonymous default export values.
With parameter module.
{
}
,
ExportSpecifieras
IdentifierNameSee also: <IP_ADDRESS>, 14.1.10, 14.4.8, 14.5.7.
export
*
FromClause ;
export
ExportClause FromClause ;
export
ExportClause ;
export
default
AssignmentExpression ;
NOTE It is not necessary to treat export
default
AssignmentExpression as a constant declaration because there is no syntax that permits assignment to
the internal bound name used to reference a module’s default object.
See also: 13.2.6, 13.12.6, 13.13.7, 14.1.14, 14.2.11, 15.1.4, <IP_ADDRESS>.
export
*
FromClause ;
export
ExportClause FromClause ;
export
ExportClause ;
export
VariableStatementexport
Declarationexport
default
HoistableDeclarationexport
default
ClassDeclarationExportDeclaration : export default
AssignmentExpression
;
See also: <IP_ADDRESS>, <IP_ADDRESS>.
ExportDeclaration : export
*
FromClause ;
export
ExportClause FromClause ;
export
ExportClause ;
export
VariableStatementexport
Declarationexport
default
HoistableDeclarationexport
default
ClassDeclarationexport
default
AssignmentExpression ;
{
}
,
ExportSpecifieras
IdentifierNameexport
*
FromClause ;
export
ExportClause FromClause ;
export
ExportClause ;
export
VariableStatementexport
Declarationexport
default
HoistableDeclarationexport
default
ClassDeclaration"*default*"
, then
"name"
)."default"
)."*default*"
,
value, env).ExportDeclaration : export default
AssignmentExpression
;
"name"
)."default"
)."*default*"
,
value, env).An implementation must report most errors at the time the relevant ECMAScript language construct is evaluated. An early
error is an error that can be detected and reported prior to the evaluation of any construct in the Script containing the error. The presence of an early error prevents the evaluation of the construct. An
implementation must report early errors in a Script as part of the ScriptEvaluationJob for that Script. Early errors in a Module are reported at the point when the Module would be evaluated and the Module is never initialized. Early errors in eval code are reported at the time eval
is
called and prevent evaluation of the eval code. All errors that are not early errors are runtime errors.
An implementation must report as an early error any occurrence of a condition that is listed in a “Static Semantics: Early Errors” subclause of this specification.
An implementation shall not treat other kinds of errors as early errors even if the compiler can prove that a construct cannot execute without error under any circumstances. An implementation may issue an early warning in such a case, but it should not report the error until the relevant construct is actually executed.
An implementation shall report all errors as specified, except for the following:
Except as restricted in 16.1, an implementation may extend Script
syntax, Module syntax, and regular expression pattern or flag syntax. To permit this, all operations (such as
calling eval
, using a regular expression literal, or using the Function
or RegExp
constructor) that are allowed to throw SyntaxError are permitted to exhibit implementation-defined behaviour
instead of throwing SyntaxError when they encounter an implementation-defined extension to the script syntax or
regular expression pattern or flag syntax.
Except as restricted in 16.1, an implementation may provide additional types, values, objects, properties, and functions beyond those described in this specification. This may cause constructs (such as looking up a variable in the global scope) to have implementation-defined behaviour instead of throwing an error (such as ReferenceError).
An implementation may define behaviour other than throwing RangeError for toFixed
,
toExponential
, and toPrecision
when the fractionDigits or precision argument
is outside the specified range.
An implementation must not extend this specification in the following ways:
Other than as defined in this specification, ECMAScript Function objects defined using syntactic constructors in strict mode code must not be created with own properties named "caller"
or
"arguments"
other than those that are created by applying the AddRestrictedFunctionProperties abstract operation (9.2.7) to the function. Such own properties also must not be created for
function objects defined using an ArrowFunction, MethodDefinition, GeneratorDeclaration, GeneratorExpression, ClassDeclaration, or ClassExpression regardless of whether the definition
is contained in strict mode code. Built-in functions, strict mode functions
created using the Function
constructor, generator functions created using the Generator
constructor, and functions created using the bind
method also must not be created with such own
properties.
If an implementation extends non-strict or built-in function objects with an own property named "caller"
the value of that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function object. If it
is an accessor property, the function that is the value of the property’s [[Get]] attribute must never return a
strict function when called.
The behaviour of the following methods must not be extended except as specified in ECMA-402: Object.prototype.toLocaleString
, Array.prototype.toLocaleString
, Number.prototype.toLocaleString
, Date.prototype.toLocaleDateString
, Date.prototype.toLocaleString
, Date.prototype.toLocaleTimeString
, String.prototype.localeCompare
.
The RegExp pattern grammars in 21.2.1 and B.1.4 must not be extended to recognize any of the source characters A-Z or a-z as IdentityEscape[U] when the U grammar parameter is present.
The Syntactic Grammar must not be extended in any manner that allows the token :
to immediate follow
source text that matches the BindingIdentifier nonterminal symbol.
When processing strict mode code, the syntax of NumericLiteral must not be extended to include LegacyOctalIntegerLiteral as defined in B.1.1.
TemplateCharacter (11.8.6) must not be extended to include LegacyOctalEscapeSequence as defined in B.1.2.
When processing strict mode code, the extensions defined in B.3.1, B.3.2, B.3.3, and B.3.4 must not be supported.
When parsing for the Module goal symbol, the lexical grammar extensions defined in B.1.3 must not be supported.
There are certain built-in objects available whenever an ECMAScript Script or Module begins execution. One, the global object, is part of the lexical environment of the executing program. Others are accessible as initial properties of the global object or indirectly as properties of accessible built-in objects.
Unless specified otherwise, a built-in object that is callable as a function is a built-in Function object with the characteristics described in 9.3. Unless specified otherwise, the [[Extensible]] internal slot of a built-in object initially has the value true. Every built-in Function object has a [[Realm]] internal slot whose value is the code Realm for which the object was initially created.