13 ECMAScript 언어: Expressions

13.1 Identifiers

Syntax

IdentifierReference[Yield, Await] : Identifier [~Yield] yield [~Await] await BindingIdentifier[Yield, Await] : Identifier yield await LabelIdentifier[Yield, Await] : Identifier [~Yield] yield [~Await] await Identifier : IdentifierName but not ReservedWord Note

yieldawait는 grammar에서 BindingIdentifier로 permitted되고, 아래 static semantics에 의해 prohibited됩니다. 이는 다음과 같은 case에서 automatic semicolon insertion을 prohibit하기 위한 것입니다.

let
await 0;

13.1.1 Static Semantics: Early Errors

BindingIdentifier : Identifier IdentifierReference : yield BindingIdentifier : yield LabelIdentifier : yield
  • IsStrict(this production)이 true이면 Syntax Error입니다.
IdentifierReference : await BindingIdentifier : await LabelIdentifier : await BindingIdentifier[Yield, Await] : yield
  • this production이 [Yield] parameter를 가지면 Syntax Error입니다.
BindingIdentifier[Yield, Await] : await
  • this production이 [Await] parameter를 가지면 Syntax Error입니다.
IdentifierReference[Yield, Await] : Identifier BindingIdentifier[Yield, Await] : Identifier LabelIdentifier[Yield, Await] : Identifier
  • this production이 [Yield] parameter를 가지고 IdentifierStringValue"yield"이면 Syntax Error입니다.
  • this production이 [Await] parameter를 가지고 IdentifierStringValue"await"이면 Syntax Error입니다.
Identifier : IdentifierName but not ReservedWord Note

IdentifierNameStringValueIdentifierName 안의 모든 Unicode escape sequence를 normalize하므로, 그러한 escape는 code point sequence가 ReservedWord와 같은 Identifier를 write하는 데 사용할 수 없습니다.

13.1.2 Static Semantics: StringValue

The syntax-directed operation StringValue takes no arguments and returns a String. It is defined piecewise over the following productions:

IdentifierName :: IdentifierStart IdentifierName IdentifierPart
  1. idTextUnescapedIdentifierNameIdentifierCodePoints로 둔다.
  2. CodePointsToString(idTextUnescaped)를 반환한다.
IdentifierReference : yield BindingIdentifier : yield LabelIdentifier : yield
  1. "yield"를 반환한다.
IdentifierReference : await BindingIdentifier : await LabelIdentifier : await
  1. "await"를 반환한다.
Identifier : IdentifierName but not ReservedWord
  1. IdentifierNameStringValue를 반환한다.
PrivateIdentifier :: # IdentifierName
  1. 0x0023 (NUMBER SIGN)과 IdentifierNameStringValuestring-concatenation을 반환한다.
ModuleExportName : StringLiteral
  1. StringLiteralSV를 반환한다.

13.1.3 Runtime Semantics: Evaluation

IdentifierReference : Identifier
  1. ResolveBinding(IdentifierStringValue)를 반환한다.
IdentifierReference : yield
  1. ResolveBinding("yield")를 반환한다.
IdentifierReference : await
  1. ResolveBinding("await")를 반환한다.
Note 1

IdentifierReference를 evaluating한 result는 항상 Reference type의 value입니다.

Note 2

non-strict code에서 keyword yield는 identifier로 사용될 수 있습니다. IdentifierReference를 evaluating하면 그것이 Identifier였던 것처럼 yield의 binding을 resolve합니다. Early Error restriction은 그러한 evaluation이 non-strict code에서만 occur할 수 있음을 ensure합니다.

13.2 Primary Expression

Syntax

PrimaryExpression[Yield, Await] : this IdentifierReference[?Yield, ?Await] Literal ArrayLiteral[?Yield, ?Await] ObjectLiteral[?Yield, ?Await] FunctionExpression ClassExpression[?Yield, ?Await] GeneratorExpression AsyncFunctionExpression AsyncGeneratorExpression RegularExpressionLiteral TemplateLiteral[?Yield, ?Await, ~Tagged] CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await] CoverParenthesizedExpressionAndArrowParameterList[Yield, Await] : ( Expression[+In, ?Yield, ?Await] ) ( Expression[+In, ?Yield, ?Await] , ) ( ) ( ... BindingIdentifier[?Yield, ?Await] ) ( ... BindingPattern[?Yield, ?Await] ) ( Expression[+In, ?Yield, ?Await] , ... BindingIdentifier[?Yield, ?Await] ) ( Expression[+In, ?Yield, ?Await] , ... BindingPattern[?Yield, ?Await] )

Supplemental Syntax

production
PrimaryExpression[Yield, Await] : CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
의 instance를 processing할 때, CoverParenthesizedExpressionAndArrowParameterList의 interpretation은 다음 grammar를 사용하여 refined됩니다:

ParenthesizedExpression[Yield, Await] : ( Expression[+In, ?Yield, ?Await] )

13.2.1 this Keyword

13.2.1.1 Runtime Semantics: Evaluation

PrimaryExpression : this
  1. ResolveThisBinding()을 반환한다.

13.2.2 Identifier Reference

IdentifierReference에 대해서는 13.1를 참조하십시오.

13.2.3 Literals

Syntax

Literal : NullLiteral BooleanLiteral NumericLiteral StringLiteral

13.2.3.1 Runtime Semantics: Evaluation

Literal : NullLiteral
  1. null을 반환한다.
Literal : BooleanLiteral
  1. BooleanLiteral이 token false이면, false를 반환한다.
  2. BooleanLiteral이 token true이면, true를 반환한다.
Literal : NumericLiteral
  1. 12.9.3에 defined된 NumericLiteralNumericValue를 반환한다.
Literal : StringLiteral
  1. 12.9.4.2에 defined된 StringLiteralSV를 반환한다.

13.2.4 Array Initializer

Note

ArrayLiteral은 square bracket으로 enclosed된, 각각 array element를 represent하는 0개 이상의 expression list를 사용하여 Array의 initialization을 describe하는 expression입니다. element는 literal일 필요가 없습니다; 이는 array initializer가 evaluated될 때마다 evaluated됩니다.

Array element는 element list의 beginning, middle 또는 end에서 elided될 수 있습니다. element list 안의 comma가 AssignmentExpression에 의해 preceded되지 않을 때마다(즉, beginning의 comma 또는 another comma 뒤의 comma), missing array element는 Array의 length에 contribute하고 subsequent element의 index를 increase합니다. Elided array element는 defined되지 않습니다. array의 end에서 element가 elided되면, 그 element는 Array의 length에 contribute하지 않습니다.

Syntax

ArrayLiteral[Yield, Await] : [ Elisionopt ] [ ElementList[?Yield, ?Await] ] [ ElementList[?Yield, ?Await] , Elisionopt ] ElementList[Yield, Await] : Elisionopt AssignmentExpression[+In, ?Yield, ?Await] Elisionopt SpreadElement[?Yield, ?Await] ElementList[?Yield, ?Await] , Elisionopt AssignmentExpression[+In, ?Yield, ?Await] ElementList[?Yield, ?Await] , Elisionopt SpreadElement[?Yield, ?Await] Elision : , Elision , SpreadElement[Yield, Await] : ... AssignmentExpression[+In, ?Yield, ?Await]

13.2.4.1 Runtime Semantics: ArrayAccumulation

The syntax-directed operation ArrayAccumulation takes arguments array (an Array) and nextIndex (an integer) and returns either a normal completion containing an integer or an abrupt completion. It is defined piecewise over the following productions:

Elision : ,
  1. lengthnextIndex + 1로 둔다.
  2. Set(array, "length", 𝔽(length), true)를 수행한다.
  3. NOTE: 위 step은 length가 232 - 1을 exceeds하면 throw한다.
  4. length를 반환한다.
Elision : Elision ,
  1. arguments array와 (nextIndex + 1)을 가진 ElisionArrayAccumulation을 ? 반환한다.
ElementList : Elisionopt AssignmentExpression
  1. Elision이 present이면, 다음을 수행한다.
    1. nextIndex를 arguments arraynextIndex를 가진 ElisionArrayAccumulation으로 ? 설정한다.
  2. initResultAssignmentExpressionEvaluation으로 ? 둔다.
  3. initValue를 ? GetValue(initResult)로 둔다.
  4. CreateDataPropertyOrThrow(array, ! ToString(𝔽(nextIndex)), initValue)를 수행한다.
  5. nextIndex + 1을 반환한다.
ElementList : Elisionopt SpreadElement
  1. Elision이 present이면, 다음을 수행한다.
    1. nextIndex를 arguments arraynextIndex를 가진 ElisionArrayAccumulation으로 ? 설정한다.
  2. arguments arraynextIndex를 가진 SpreadElementArrayAccumulation을 ? 반환한다.
ElementList : ElementList , Elisionopt AssignmentExpression
  1. nextIndex를 arguments arraynextIndex를 가진 derived ElementListArrayAccumulation으로 ? 설정한다.
  2. Elision이 present이면, 다음을 수행한다.
    1. nextIndex를 arguments arraynextIndex를 가진 ElisionArrayAccumulation으로 ? 설정한다.
  3. initResultAssignmentExpressionEvaluation으로 ? 둔다.
  4. initValue를 ? GetValue(initResult)로 둔다.
  5. CreateDataPropertyOrThrow(array, ! ToString(𝔽(nextIndex)), initValue)를 수행한다.
  6. nextIndex + 1을 반환한다.
ElementList : ElementList , Elisionopt SpreadElement
  1. nextIndex를 arguments arraynextIndex를 가진 derived ElementListArrayAccumulation으로 ? 설정한다.
  2. Elision이 present이면, 다음을 수행한다.
    1. nextIndex를 arguments arraynextIndex를 가진 ElisionArrayAccumulation으로 ? 설정한다.
  3. arguments arraynextIndex를 가진 SpreadElementArrayAccumulation을 ? 반환한다.
SpreadElement : ... AssignmentExpression
  1. spreadRefAssignmentExpressionEvaluation으로 ? 둔다.
  2. spreadObj를 ? GetValue(spreadRef)로 둔다.
  3. iteratorRecord를 ? GetIterator(spreadObj, sync)로 둔다.
  4. Repeat,
    1. next를 ? IteratorStepValue(iteratorRecord)로 둔다.
    2. nextdone이면, nextIndex를 반환한다.
    3. CreateDataPropertyOrThrow(array, ! ToString(𝔽(nextIndex)), next)를 수행한다.
    4. nextIndexnextIndex + 1로 설정한다.
Note

CreateDataPropertyOrThrow는 standard built-in Array prototype object[[Set]]을 사용한 new own property creation을 preclude하는 manner로 modified되었더라도 own property가 array에 defined되도록 ensure하기 위해 사용됩니다.

13.2.4.2 Runtime Semantics: Evaluation

ArrayLiteral : [ Elisionopt ]
  1. array를 ! ArrayCreate(0)으로 둔다.
  2. Elision이 present이면, 다음을 수행한다.
    1. arguments array와 0을 가진 ElisionArrayAccumulation을 ? 수행한다.
  3. array를 반환한다.
ArrayLiteral : [ ElementList ]
  1. array를 ! ArrayCreate(0)으로 둔다.
  2. arguments array와 0을 가진 ElementListArrayAccumulation을 ? 수행한다.
  3. array를 반환한다.
ArrayLiteral : [ ElementList , Elisionopt ]
  1. array를 ! ArrayCreate(0)으로 둔다.
  2. nextIndex를 arguments array와 0을 가진 ElementListArrayAccumulation으로 ? 둔다.
  3. Elision이 present이면, 다음을 수행한다.
    1. arguments arraynextIndex를 가진 ElisionArrayAccumulation을 ? 수행한다.
  4. array를 반환한다.

13.2.5 Object Initializer

Note 1

object initializer는 literal과 resembling한 form으로 written된, Object의 initialization을 describe하는 expression입니다. 이는 curly bracket으로 enclosed된, 0개 이상의 property key와 associated value pair의 list입니다. value는 literal일 필요가 없습니다; 이는 object initializer가 evaluated될 때마다 evaluated됩니다.

Syntax

ObjectLiteral[Yield, Await] : { } { PropertyDefinitionList[?Yield, ?Await] } { PropertyDefinitionList[?Yield, ?Await] , } PropertyDefinitionList[Yield, Await] : PropertyDefinition[?Yield, ?Await] PropertyDefinitionList[?Yield, ?Await] , PropertyDefinition[?Yield, ?Await] PropertyDefinition[Yield, Await] : IdentifierReference[?Yield, ?Await] CoverInitializedName[?Yield, ?Await] PropertyName[?Yield, ?Await] : AssignmentExpression[+In, ?Yield, ?Await] MethodDefinition[?Yield, ?Await] ... AssignmentExpression[+In, ?Yield, ?Await] PropertyName[Yield, Await] : LiteralPropertyName ComputedPropertyName[?Yield, ?Await] LiteralPropertyName : IdentifierName StringLiteral NumericLiteral ComputedPropertyName[Yield, Await] : [ AssignmentExpression[+In, ?Yield, ?Await] ] CoverInitializedName[Yield, Await] : IdentifierReference[?Yield, ?Await] Initializer[+In, ?Yield, ?Await] Initializer[In, Yield, Await] : = AssignmentExpression[?In, ?Yield, ?Await] Note 2

MethodDefinition15.4에 defined되어 있습니다.

Note 3

certain context에서 ObjectLiteral은 더 restricted된 secondary grammar를 위한 cover grammar로 사용됩니다. CoverInitializedName production은 이러한 secondary grammar를 fully cover하기 위해 necessary합니다. 그러나 이 production의 사용은 actual ObjectLiteral이 expected되는 normal context에서 early Syntax Error를 result합니다.

13.2.5.1 Static Semantics: Early Errors

PropertyDefinition : MethodDefinition

actual object initializer를 describing하는 것 외에도 ObjectLiteral production은 ObjectAssignmentPattern을 위한 cover grammar로도 사용되며, CoverParenthesizedExpressionAndArrowParameterList의 part로 recognized될 수 있습니다. ObjectLiteralObjectAssignmentPattern이 required되는 context에 appear하면 다음 Early Error rule은 applied되지 않습니다. 또한 CoverParenthesizedExpressionAndArrowParameterList 또는 CoverCallExpressionAndAsyncArrowHead를 initially parsing할 때도 applied되지 않습니다.

PropertyDefinition : CoverInitializedName
  • 이 production에 의해 source text가 matched되면 Syntax Error입니다.
Note 1

이 production은 ObjectLiteralObjectAssignmentPattern을 위한 cover grammar로 serve할 수 있도록 존재합니다. 이는 actual object initializer 안에 occur할 수 없습니다.

ObjectLiteral : { PropertyDefinitionList } { PropertyDefinitionList , } Note 2

PropertyNameList가 반환하는 ListComputedPropertyName을 사용하여 defined된 property name을 include하지 않습니다.

13.2.5.2 Static Semantics: IsComputedPropertyKey

The syntax-directed operation IsComputedPropertyKey takes no arguments and returns a Boolean. It is defined piecewise over the following productions:

PropertyName : LiteralPropertyName
  1. false를 반환한다.
PropertyName : ComputedPropertyName
  1. true를 반환한다.

13.2.5.3 Static Semantics: PropertyDefinitionNodes

The syntax-directed operation PropertyDefinitionNodes takes no arguments and returns a List of Parse Nodes. It is defined piecewise over the following productions:

ObjectLiteral : { }
  1. 새 empty List를 반환한다.
PropertyDefinitionList : PropertyDefinition
  1. « PropertyDefinition »를 반환한다.
PropertyDefinitionList : PropertyDefinitionList , PropertyDefinition
  1. head를 derived PropertyDefinitionListPropertyDefinitionNodes로 둔다.
  2. head와 « PropertyDefinition »의 list-concatenation을 반환한다.

13.2.5.4 Static Semantics: PropertyNameList

The syntax-directed operation PropertyNameList takes no arguments and returns a List of Strings. It is defined piecewise over the following productions:

PropertyDefinitionList : PropertyDefinition
  1. propertyNamePropertyDefinitionPropName으로 둔다.
  2. propertyNameempty이면, 새 empty List를 반환한다.
  3. « propertyName »를 반환한다.
PropertyDefinitionList : PropertyDefinitionList , PropertyDefinition
  1. listPropertyDefinitionListPropertyNameList로 둔다.
  2. propertyNamePropertyDefinitionPropName으로 둔다.
  3. propertyNameempty이면, list를 반환한다.
  4. list와 « propertyName »의 list-concatenation을 반환한다.

13.2.5.5 Runtime Semantics: Evaluation

ObjectLiteral : { }
  1. OrdinaryObjectCreate(%Object.prototype%)를 반환한다.
ObjectLiteral : { PropertyDefinitionList } { PropertyDefinitionList , }
  1. objOrdinaryObjectCreate(%Object.prototype%)로 둔다.
  2. argument obj를 가진 PropertyDefinitionListPropertyDefinitionEvaluation을 ? 수행한다.
  3. obj를 반환한다.
LiteralPropertyName : IdentifierName
  1. IdentifierNameStringValue를 반환한다.
LiteralPropertyName : StringLiteral
  1. StringLiteralSV를 반환한다.
LiteralPropertyName : NumericLiteral
  1. numberNumericLiteralNumericValue로 둔다.
  2. ToString(number)를 반환한다.
ComputedPropertyName : [ AssignmentExpression ]
  1. exprValueAssignmentExpressionEvaluation으로 ? 둔다.
  2. propertyName을 ? GetValue(exprValue)로 둔다.
  3. ToPropertyKey(propertyName)를 반환한다.

13.2.5.6 Runtime Semantics: PropertyDefinitionEvaluation

The syntax-directed operation PropertyDefinitionEvaluation takes argument obj (an Object) and returns either a normal completion containing unused or an abrupt completion. It is defined piecewise over the following productions:

PropertyDefinitionList : PropertyDefinitionList , PropertyDefinition
  1. argument obj를 가진 PropertyDefinitionListPropertyDefinitionEvaluation을 ? 수행한다.
  2. argument obj를 가진 PropertyDefinitionPropertyDefinitionEvaluation을 ? 수행한다.
  3. unused를 반환한다.
PropertyDefinition : ... AssignmentExpression
  1. exprValueAssignmentExpressionEvaluation으로 ? 둔다.
  2. fromValue를 ? GetValue(exprValue)로 둔다.
  3. excludedNames를 새 empty List로 둔다.
  4. CopyDataProperties(obj, fromValue, excludedNames)를 수행한다.
  5. unused를 반환한다.
PropertyDefinition : IdentifierReference
  1. propertyNameIdentifierReferenceStringValue로 둔다.
  2. exprValueIdentifierReferenceEvaluation으로 ? 둔다.
  3. propertyValue를 ? GetValue(exprValue)로 둔다.
  4. Assert: obj는 non-configurable property가 없는 ordinary, extensible object이다.
  5. CreateDataPropertyOrThrow(obj, propertyName, propertyValue)를 수행한다.
  6. unused를 반환한다.
PropertyDefinition : PropertyName : AssignmentExpression
  1. propertyKeyPropertyNameEvaluation으로 ? 둔다.
  2. PropertyDefinitionParseJSON을 위해 evaluated되는 Script 안에 contained되어 있으면(ParseJSON의 step 6 참조), 다음을 수행한다.
    1. isProtoSetterfalse로 둔다.
  3. 그렇지 않고 propertyKey"__proto__"이고 PropertyNameIsComputedPropertyKeyfalse이면, 다음을 수행한다.
    1. isProtoSettertrue로 둔다.
  4. 그렇지 않으면,
    1. isProtoSetterfalse로 둔다.
  5. IsAnonymousFunctionDefinition(AssignmentExpression)이 true이고 isProtoSetterfalse이면, 다음을 수행한다.
    1. propertyValue를 argument propertyKey를 가진 AssignmentExpressionNamedEvaluation으로 ? 둔다.
  6. 그렇지 않으면,
    1. exprValueRefAssignmentExpressionEvaluation으로 ? 둔다.
    2. propertyValue를 ? GetValue(exprValueRef)로 둔다.
  7. isProtoSettertrue이면, 다음을 수행한다.
    1. propertyValue가 Object이거나 propertyValuenull이면, 다음을 수행한다.
      1. obj.[[SetPrototypeOf]](propertyValue)를 수행한다.
    2. unused를 반환한다.
  8. Assert: obj는 non-configurable property가 없는 ordinary, extensible object이다.
  9. CreateDataPropertyOrThrow(obj, propertyKey, propertyValue)를 수행한다.
  10. unused를 반환한다.
PropertyDefinition : MethodDefinition
  1. arguments objtrue를 가진 MethodDefinitionMethodDefinitionEvaluation을 ? 수행한다.
  2. unused를 반환한다.

13.2.6 Function Defining Expressions

PrimaryExpression : FunctionExpression 에 대해서는 15.2를 참조하십시오.

PrimaryExpression : GeneratorExpression 에 대해서는 15.5를 참조하십시오.

PrimaryExpression : ClassExpression 에 대해서는 15.7를 참조하십시오.

PrimaryExpression : AsyncFunctionExpression 에 대해서는 15.8를 참조하십시오.

PrimaryExpression : AsyncGeneratorExpression 에 대해서는 15.6를 참조하십시오.

13.2.7 Regular Expression Literals

Syntax

12.9.5를 참조하십시오.

13.2.7.1 Static Semantics: Early Errors

PrimaryExpression : RegularExpressionLiteral

13.2.7.2 Static Semantics: IsValidRegularExpressionLiteral ( literal )

The abstract operation IsValidRegularExpressionLiteral takes argument literal (a RegularExpressionLiteral Parse Node) and returns a Boolean. argument가 valid regular expression literal인지 determine합니다. It performs the following steps when called:

  1. flagsliteralFlagText로 둔다.
  2. flagsd, g, i, m, s, u, v, 또는 y 이외의 code point를 contain하면, false를 반환한다.
  3. flags가 어떤 code point를 두 번 이상 contain하면, false를 반환한다.
  4. flagsu를 contain하면, utrue로 둔다; 그렇지 않으면 ufalse로 둔다.
  5. flagsv를 contain하면, vtrue로 둔다; 그렇지 않으면 vfalse로 둔다.
  6. patternTextliteralBodyText로 둔다.
  7. ufalse이고 vfalse이면, 다음을 수행한다.
    1. stringValueCodePointsToString(patternText)로 둔다.
    2. patternTextstringValue의 각 16-bit element를 Unicode BMP code point로 interpreting한 result인 code point sequence로 설정한다. UTF-16 decoding은 element에 applied되지 않는다.
  8. parseResultParsePattern(patternText, u, v)로 둔다.
  9. parseResultParse Node이면, true를 반환한다.
  10. false를 반환한다.

13.2.7.3 Runtime Semantics: Evaluation

PrimaryExpression : RegularExpressionLiteral
  1. patternCodePointsToString(RegularExpressionLiteralBodyText)로 둔다.
  2. flagsCodePointsToString(RegularExpressionLiteralFlagText)로 둔다.
  3. RegExpCreate(pattern, flags)를 반환한다.

13.2.8 Template Literals

Syntax

TemplateLiteral[Yield, Await, Tagged] : NoSubstitutionTemplate SubstitutionTemplate[?Yield, ?Await, ?Tagged] SubstitutionTemplate[Yield, Await, Tagged] : TemplateHead Expression[+In, ?Yield, ?Await] TemplateSpans[?Yield, ?Await, ?Tagged] TemplateSpans[Yield, Await, Tagged] : TemplateTail TemplateMiddleList[?Yield, ?Await, ?Tagged] TemplateTail TemplateMiddleList[Yield, Await, Tagged] : TemplateMiddle Expression[+In, ?Yield, ?Await] TemplateMiddleList[?Yield, ?Await, ?Tagged] TemplateMiddle Expression[+In, ?Yield, ?Await]

13.2.8.1 Static Semantics: Early Errors

TemplateLiteral[Yield, Await, Tagged] : NoSubstitutionTemplate TemplateLiteral[Yield, Await, Tagged] : SubstitutionTemplate[?Yield, ?Await, ?Tagged] SubstitutionTemplate[Yield, Await, Tagged] : TemplateHead Expression[+In, ?Yield, ?Await] TemplateSpans[?Yield, ?Await, ?Tagged] TemplateSpans[Yield, Await, Tagged] : TemplateTail TemplateMiddleList[Yield, Await, Tagged] : TemplateMiddle Expression[+In, ?Yield, ?Await] TemplateMiddleList[?Yield, ?Await, ?Tagged] TemplateMiddle Expression[+In, ?Yield, ?Await]

13.2.8.2 Static Semantics: TemplateStrings

The syntax-directed operation TemplateStrings takes argument raw (a Boolean) and returns a List of either Strings or undefined. It is defined piecewise over the following productions:

TemplateLiteral : NoSubstitutionTemplate
  1. « TemplateString(NoSubstitutionTemplate, raw) »를 반환한다.
SubstitutionTemplate : TemplateHead Expression TemplateSpans
  1. head를 « TemplateString(TemplateHead, raw) »로 둔다.
  2. tail을 argument raw를 가진 TemplateSpansTemplateStrings로 둔다.
  3. headtaillist-concatenation을 반환한다.
TemplateSpans : TemplateTail
  1. « TemplateString(TemplateTail, raw) »를 반환한다.
TemplateSpans : TemplateMiddleList TemplateTail
  1. middle을 argument raw를 가진 TemplateMiddleListTemplateStrings로 둔다.
  2. tail을 « TemplateString(TemplateTail, raw) »로 둔다.
  3. middletaillist-concatenation을 반환한다.
TemplateMiddleList : TemplateMiddle Expression
  1. « TemplateString(TemplateMiddle, raw) »를 반환한다.
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
  1. front를 argument raw를 가진 TemplateMiddleListTemplateStrings로 둔다.
  2. last를 « TemplateString(TemplateMiddle, raw) »로 둔다.
  3. frontlastlist-concatenation을 반환한다.

13.2.8.3 Static Semantics: TemplateString ( templateToken, raw )

The abstract operation TemplateString takes arguments templateToken (a NoSubstitutionTemplate Parse Node, a TemplateHead Parse Node, a TemplateMiddle Parse Node, or a TemplateTail Parse Node) and raw (a Boolean) and returns a String or undefined. It performs the following steps when called:

  1. rawtrue이면, 다음을 수행한다.
    1. stringtemplateTokenTRV로 둔다.
  2. 그렇지 않으면,
    1. stringtemplateTokenTV로 둔다.
  3. string을 반환한다.
Note

이 operation은 rawfalse이고 templateTokenNotEscapeSequence를 contain하면 undefined를 반환합니다. 그 밖의 모든 경우에는 String을 반환합니다.

13.2.8.4 GetTemplateObject ( templateLiteral )

The abstract operation GetTemplateObject takes argument templateLiteral (a Parse Node) and returns an Array. It performs the following steps when called:

  1. realm을 current Realm Record로 둔다.
  2. templateRegistryrealm.[[TemplateMap]]으로 둔다.
  3. templateRegistry의 각 element element에 대해, 다음을 수행한다.
    1. element.[[Site]]templateLiteral과 같은 Parse Node이면, 다음을 수행한다.
      1. element.[[Array]]를 반환한다.
  4. rawStrings를 argument true를 가진 templateLiteralTemplateStrings로 둔다.
  5. Assert: rawStrings는 String의 List이다.
  6. cookedStrings를 argument false를 가진 templateLiteralTemplateStrings로 둔다.
  7. countList cookedStrings 안의 element 수로 둔다.
  8. Assert: count ≤ 232 - 1이다.
  9. template을 ! ArrayCreate(count)로 둔다.
  10. rawObj를 ! ArrayCreate(count)로 둔다.
  11. index를 0으로 둔다.
  12. index < count인 동안 Repeat,
    1. propertyKey를 ! ToString(𝔽(index))로 둔다.
    2. cookedValuecookedStrings[index]로 둔다.
    3. DefinePropertyOrThrow(template, propertyKey, PropertyDescriptor { [[Value]]: cookedValue, [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: false })를 수행한다.
    4. rawValue를 String value rawStrings[index]로 둔다.
    5. DefinePropertyOrThrow(rawObj, propertyKey, PropertyDescriptor { [[Value]]: rawValue, [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: false })를 수행한다.
    6. indexindex + 1로 설정한다.
  13. SetIntegrityLevel(rawObj, frozen)을 수행한다.
  14. DefinePropertyOrThrow(template, "raw", PropertyDescriptor { [[Value]]: rawObj, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false })를 수행한다.
  15. SetIntegrityLevel(template, frozen)을 수행한다.
  16. Record { [[Site]]: templateLiteral, [[Array]]: template }를 realm.[[TemplateMap]]에 append한다.
  17. template을 반환한다.
Note 1

template object의 creation은 abrupt completion을 result할 수 없습니다.

Note 2

realm의 program code 안의 각 TemplateLiteral은 tagged Template의 evaluation(13.2.8.6)에 사용되는 unique template object와 associated됩니다. template object는 frozen되며, specific tagged Template이 evaluated될 때마다 같은 template object가 사용됩니다. template object가 TemplateLiteral의 first evaluation 시 lazily created되는지 또는 first evaluation 전에 eagerly created되는지는 ECMAScript code에는 observable하지 않은 implementation choice입니다.

Note 3

이 명세의 future edition은 template object의 additional non-enumerable property를 define할 수 있습니다.

13.2.8.5 Runtime Semantics: SubstitutionEvaluation

The syntax-directed operation SubstitutionEvaluation takes no arguments and returns either a normal completion containing a List of ECMAScript language values or an abrupt completion. It is defined piecewise over the following productions:

TemplateSpans : TemplateTail
  1. 새 empty List를 반환한다.
TemplateSpans : TemplateMiddleList TemplateTail
  1. TemplateMiddleListSubstitutionEvaluation을 ? 반환한다.
TemplateMiddleList : TemplateMiddle Expression
  1. subRefExpressionEvaluation으로 ? 둔다.
  2. sub를 ? GetValue(subRef)로 둔다.
  3. « sub »를 반환한다.
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
  1. precedingTemplateMiddleListSubstitutionEvaluation으로 ? 둔다.
  2. nextRefExpressionEvaluation으로 ? 둔다.
  3. next를 ? GetValue(nextRef)로 둔다.
  4. preceding과 « next »의 list-concatenation을 반환한다.

13.2.8.6 Runtime Semantics: Evaluation

TemplateLiteral : NoSubstitutionTemplate
  1. 12.9.6에 defined된 NoSubstitutionTemplateTV를 반환한다.
SubstitutionTemplate : TemplateHead Expression TemplateSpans
  1. head12.9.6에 defined된 TemplateHeadTV로 둔다.
  2. subRefExpressionEvaluation으로 ? 둔다.
  3. sub를 ? GetValue(subRef)로 둔다.
  4. middle을 ? ToString(sub)로 둔다.
  5. tailTemplateSpansEvaluation으로 ? 둔다.
  6. head, middle, tailstring-concatenation을 반환한다.
Note 1

Expression value에 applied되는 string conversion semantics는 + operator가 아니라 String.prototype.concat과 같습니다.

TemplateSpans : TemplateTail
  1. 12.9.6에 defined된 TemplateTailTV를 반환한다.
TemplateSpans : TemplateMiddleList TemplateTail
  1. headTemplateMiddleListEvaluation으로 ? 둔다.
  2. tail12.9.6에 defined된 TemplateTailTV로 둔다.
  3. headtailstring-concatenation을 반환한다.
TemplateMiddleList : TemplateMiddle Expression
  1. head12.9.6에 defined된 TemplateMiddleTV로 둔다.
  2. subRefExpressionEvaluation으로 ? 둔다.
  3. sub를 ? GetValue(subRef)로 둔다.
  4. middle을 ? ToString(sub)로 둔다.
  5. headmiddlestring-concatenation을 반환한다.
Note 2

Expression value에 applied되는 string conversion semantics는 + operator가 아니라 String.prototype.concat과 같습니다.

TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
  1. restTemplateMiddleListEvaluation으로 ? 둔다.
  2. middle12.9.6에 defined된 TemplateMiddleTV로 둔다.
  3. subRefExpressionEvaluation으로 ? 둔다.
  4. sub를 ? GetValue(subRef)로 둔다.
  5. last를 ? ToString(sub)로 둔다.
  6. rest, middle, laststring-concatenation을 반환한다.
Note 3

Expression value에 applied되는 string conversion semantics는 + operator가 아니라 String.prototype.concat과 같습니다.

13.2.9 Grouping Operator

13.2.9.1 Static Semantics: Early Errors

PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList

13.2.9.2 Runtime Semantics: Evaluation

PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList
  1. exprCoverParenthesizedExpressionAndArrowParameterList에 의해 covered되는 ParenthesizedExpression로 둔다.
  2. exprEvaluation을 ? 반환한다.
ParenthesizedExpression : ( Expression )
  1. ExpressionEvaluation을 ? 반환한다. 이는 Reference type일 수 있다.
Note

이 algorithm은 ExpressionEvaluationGetValue를 apply하지 않습니다. 이에 대한 principal motivation은 deletetypeof 같은 operator가 parenthesized expression에 applied될 수 있도록 하기 위한 것입니다.

13.3 Left-Hand-Side Expressions

Syntax

MemberExpression[Yield, Await] : PrimaryExpression[?Yield, ?Await] MemberExpression[?Yield, ?Await] [ Expression[+In, ?Yield, ?Await] ] MemberExpression[?Yield, ?Await] . IdentifierName MemberExpression[?Yield, ?Await] TemplateLiteral[?Yield, ?Await, +Tagged] SuperProperty[?Yield, ?Await] MetaProperty new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await] MemberExpression[?Yield, ?Await] . PrivateIdentifier SuperProperty[Yield, Await] : super [ Expression[+In, ?Yield, ?Await] ] super . IdentifierName MetaProperty : NewTarget ImportMeta NewTarget : new . target ImportMeta : import . meta NewExpression[Yield, Await] : MemberExpression[?Yield, ?Await] new NewExpression[?Yield, ?Await] CallExpression[Yield, Await] : CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await] SuperCall[?Yield, ?Await] ImportCall[?Yield, ?Await] CallExpression[?Yield, ?Await] Arguments[?Yield, ?Await] CallExpression[?Yield, ?Await] [ Expression[+In, ?Yield, ?Await] ] CallExpression[?Yield, ?Await] . IdentifierName CallExpression[?Yield, ?Await] TemplateLiteral[?Yield, ?Await, +Tagged] CallExpression[?Yield, ?Await] . PrivateIdentifier SuperCall[Yield, Await] : super Arguments[?Yield, ?Await] ImportCall[Yield, Await] : import ( AssignmentExpression[+In, ?Yield, ?Await] ,opt ) import ( AssignmentExpression[+In, ?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ,opt ) Arguments[Yield, Await] : ( ) ( ArgumentList[?Yield, ?Await] ) ( ArgumentList[?Yield, ?Await] , ) ArgumentList[Yield, Await] : AssignmentExpression[+In, ?Yield, ?Await] ... AssignmentExpression[+In, ?Yield, ?Await] ArgumentList[?Yield, ?Await] , AssignmentExpression[+In, ?Yield, ?Await] ArgumentList[?Yield, ?Await] , ... AssignmentExpression[+In, ?Yield, ?Await] OptionalExpression[Yield, Await] : MemberExpression[?Yield, ?Await] OptionalChain[?Yield, ?Await] CallExpression[?Yield, ?Await] OptionalChain[?Yield, ?Await] OptionalExpression[?Yield, ?Await] OptionalChain[?Yield, ?Await] OptionalChain[Yield, Await] : ?. Arguments[?Yield, ?Await] ?. [ Expression[+In, ?Yield, ?Await] ] ?. IdentifierName ?. TemplateLiteral[?Yield, ?Await, +Tagged] ?. PrivateIdentifier OptionalChain[?Yield, ?Await] Arguments[?Yield, ?Await] OptionalChain[?Yield, ?Await] [ Expression[+In, ?Yield, ?Await] ] OptionalChain[?Yield, ?Await] . IdentifierName OptionalChain[?Yield, ?Await] TemplateLiteral[?Yield, ?Await, +Tagged] OptionalChain[?Yield, ?Await] . PrivateIdentifier LeftHandSideExpression[Yield, Await] : NewExpression[?Yield, ?Await] CallExpression[?Yield, ?Await] OptionalExpression[?Yield, ?Await]

Supplemental Syntax

production
CallExpression : CoverCallExpressionAndAsyncArrowHead
의 instance를 processing할 때, CoverCallExpressionAndAsyncArrowHead의 interpretation은 다음 grammar를 사용하여 refined됩니다:

CallMemberExpression[Yield, Await] : MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]

13.3.1 Static Semantics

13.3.1.1 Static Semantics: Early Errors

OptionalChain : ?. TemplateLiteral OptionalChain TemplateLiteral
  • 이 production에 의해 source text가 matched되면 Syntax Error입니다.
Note

이 production은 다음 code에 automatic semicolon insertion rule(12.10)이 applied되는 것을 prevent하기 위해 존재합니다:

a?.b
`c`

따라서 이것이 두 개의 valid statement로 interpreted되지 않도록 합니다. 그 purpose는 optional chaining이 없는 similar code와 consistency를 maintain하는 것입니다:

a.b
`c`

이는 valid statement이며 automatic semicolon insertion이 apply되지 않습니다.

ImportMeta : import . meta

13.3.2 Property Accessors

Note

Property는 dot notation을 사용하여 name으로 accessed됩니다:

또는 bracket notation을 사용합니다:

dot notation은 다음 syntactic conversion에 의해 explained됩니다:

는 그 behaviour가 다음과 identical합니다

MemberExpression [ <identifier-name-string> ]

그리고 similarly

는 그 behaviour가 다음과 identical합니다

CallExpression [ <identifier-name-string> ]

여기서 <identifier-name-string>은 IdentifierNameStringValue입니다.

13.3.2.1 Runtime Semantics: Evaluation

MemberExpression : MemberExpression [ Expression ]
  1. baseRefMemberExpressionEvaluation으로 ? 둔다.
  2. baseValue를 ? GetValue(baseRef)로 둔다.
  3. strictIsStrict(this MemberExpression)로 둔다.
  4. EvaluatePropertyAccessWithExpressionKey(baseValue, Expression, strict)를 반환한다.
MemberExpression : MemberExpression . IdentifierName
  1. baseRefMemberExpressionEvaluation으로 ? 둔다.
  2. baseValue를 ? GetValue(baseRef)로 둔다.
  3. strictIsStrict(this MemberExpression)로 둔다.
  4. EvaluatePropertyAccessWithIdentifierKey(baseValue, IdentifierName, strict)를 반환한다.
MemberExpression : MemberExpression . PrivateIdentifier
  1. baseRefMemberExpressionEvaluation으로 ? 둔다.
  2. baseValue를 ? GetValue(baseRef)로 둔다.
  3. fieldNameStringPrivateIdentifierStringValue로 둔다.
  4. MakePrivateReference(baseValue, fieldNameString)를 반환한다.
CallExpression : CallExpression [ Expression ]
  1. baseRefCallExpressionEvaluation으로 ? 둔다.
  2. baseValue를 ? GetValue(baseRef)로 둔다.
  3. strictIsStrict(this CallExpression)로 둔다.
  4. EvaluatePropertyAccessWithExpressionKey(baseValue, Expression, strict)를 반환한다.
CallExpression : CallExpression . IdentifierName
  1. baseRefCallExpressionEvaluation으로 ? 둔다.
  2. baseValue를 ? GetValue(baseRef)로 둔다.
  3. strictIsStrict(this CallExpression)로 둔다.
  4. EvaluatePropertyAccessWithIdentifierKey(baseValue, IdentifierName, strict)를 반환한다.
CallExpression : CallExpression . PrivateIdentifier
  1. baseRefCallExpressionEvaluation으로 ? 둔다.
  2. baseValue를 ? GetValue(baseRef)로 둔다.
  3. fieldNameStringPrivateIdentifierStringValue로 둔다.
  4. MakePrivateReference(baseValue, fieldNameString)를 반환한다.

13.3.3 EvaluatePropertyAccessWithExpressionKey ( baseValue, expr, strict )

The abstract operation EvaluatePropertyAccessWithExpressionKey takes arguments baseValue (an ECMAScript language value), expr (an Expression Parse Node), and strict (a Boolean) and returns either a normal completion containing a Reference Record or an abrupt completion. It performs the following steps when called:

  1. propertyNameRefexprEvaluation으로 ? 둔다.
  2. propertyNameValue를 ? GetValue(propertyNameRef)로 둔다.
  3. NOTE: 대부분의 경우, ToPropertyKey는 이 step 직후 propertyNameValue에 대해 performed됩니다. 그러나 a[b] = c의 경우에는 c의 evaluation 이후까지 performed되지 않습니다.
  4. Reference Record { [[Base]]: baseValue, [[ReferencedName]]: propertyNameValue, [[Strict]]: strict, [[ThisValue]]: empty }를 반환한다.

13.3.4 EvaluatePropertyAccessWithIdentifierKey ( baseValue, identifierName, strict )

The abstract operation EvaluatePropertyAccessWithIdentifierKey takes arguments baseValue (an ECMAScript language value), identifierName (an IdentifierName Parse Node), and strict (a Boolean) and returns a Reference Record. It performs the following steps when called:

  1. propertyNameStringidentifierNameStringValue로 둔다.
  2. Reference Record { [[Base]]: baseValue, [[ReferencedName]]: propertyNameString, [[Strict]]: strict, [[ThisValue]]: empty }를 반환한다.

13.3.5 new Operator

13.3.5.1 Runtime Semantics: Evaluation

NewExpression : new NewExpression
  1. EvaluateNew(NewExpression, empty)를 반환한다.
MemberExpression : new MemberExpression Arguments
  1. EvaluateNew(MemberExpression, Arguments)를 반환한다.

13.3.5.1.1 EvaluateNew ( constructExpr, argumentsNode )

The abstract operation EvaluateNew takes arguments constructExpr (a NewExpression Parse Node or a MemberExpression Parse Node) and argumentsNode (empty or an Arguments Parse Node) and returns either a normal completion containing an Object or an abrupt completion. It performs the following steps when called:

  1. refconstructExprEvaluation으로 ? 둔다.
  2. ctor를 ? GetValue(ref)로 둔다.
  3. argumentsNodeempty이면, 다음을 수행한다.
    1. argList를 새 empty List로 둔다.
  4. 그렇지 않으면,
    1. argListargumentsNodeArgumentListEvaluation으로 ? 둔다.
  5. IsConstructor(ctor)가 false이면, TypeError exception을 throw한다.
  6. Construct(ctor, argList)를 반환한다.

13.3.6 Function Calls

13.3.6.1 Runtime Semantics: Evaluation

CallExpression : CoverCallExpressionAndAsyncArrowHead
  1. exprCoverCallExpressionAndAsyncArrowHead에 의해 covered되는 CallMemberExpression으로 둔다.
  2. memberExprexprMemberExpression으로 둔다.
  3. argsexprArguments로 둔다.
  4. refmemberExprEvaluation으로 ? 둔다.
  5. func를 ? GetValue(ref)로 둔다.
  6. refReference Record이고, IsPropertyReference(ref)가 false이며, ref.[[ReferencedName]]"eval"이면, 다음을 수행한다.
    1. SameValue(func, %eval%)가 true이면, 다음을 수행한다.
      1. argListargsArgumentListEvaluation으로 ? 둔다.
      2. argList가 element를 가지지 않으면, undefined를 반환한다.
      3. evalArgargList의 first element로 둔다.
      4. IsStrict(this CallExpression)가 true이면, strictCallertrue로 둔다; 그렇지 않으면 strictCallerfalse로 둔다.
      5. PerformEval(evalArg, strictCaller, true)를 반환한다.
  7. thisCall을 this CallExpression로 둔다.
  8. tailCallIsInTailPosition(thisCall)으로 둔다.
  9. EvaluateCall(func, ref, args, tailCall)를 반환한다.

step 6.a.v를 execute하는 CallExpression evaluation은 direct eval입니다.

CallExpression : CallExpression Arguments
  1. refCallExpressionEvaluation으로 ? 둔다.
  2. func를 ? GetValue(ref)로 둔다.
  3. thisCall을 this CallExpression로 둔다.
  4. tailCallIsInTailPosition(thisCall)으로 둔다.
  5. EvaluateCall(func, ref, Arguments, tailCall)를 반환한다.

13.3.6.2 EvaluateCall ( func, thisValueRef, argumentListNode, tailPosition )

The abstract operation EvaluateCall takes arguments func (an ECMAScript language value), thisValueRef (an ECMAScript language value or a Reference Record), argumentListNode (a Parse Node), and tailPosition (a Boolean) and returns either a normal completion containing an ECMAScript language value or an abrupt completion. It performs the following steps when called:

  1. thisValueRefReference Record이면, 다음을 수행한다.
    1. IsPropertyReference(thisValueRef)가 true이면, 다음을 수행한다.
      1. thisValueGetThisValue(thisValueRef)로 둔다.
    2. 그렇지 않으면,
      1. refEnvthisValueRef.[[Base]]로 둔다.
      2. Assert: refEnvEnvironment Record이다.
      3. thisValuerefEnv.WithBaseObject()로 둔다.
  2. 그렇지 않으면,
    1. thisValueundefined로 둔다.
  3. argListargumentListNodeArgumentListEvaluation으로 ? 둔다.
  4. func가 Object가 아니면, TypeError exception을 throw한다.
  5. IsCallable(func)가 false이면, TypeError exception을 throw한다.
  6. tailPositiontrue이면, PrepareForTailCall()을 수행한다.
  7. Call(func, thisValue, argList)를 반환한다.

13.3.7 super Keyword

13.3.7.1 Runtime Semantics: Evaluation

SuperProperty : super [ Expression ]
  1. envRecordGetThisEnvironment()로 둔다.
  2. actualThis를 ? envRecord.GetThisBinding()으로 둔다.
  3. propertyNameRefExpressionEvaluation으로 ? 둔다.
  4. propertyNameValue를 ? GetValue(propertyNameRef)로 둔다.
  5. strictIsStrict(this SuperProperty)로 둔다.
  6. NOTE: 대부분의 경우, ToPropertyKey는 이 step 직후 propertyNameValue에 대해 performed됩니다. 그러나 super[b] = c의 경우에는 c의 evaluation 이후까지 performed되지 않습니다.
  7. MakeSuperPropertyReference(actualThis, propertyNameValue, strict)를 반환한다.
SuperProperty : super . IdentifierName
  1. envRecordGetThisEnvironment()로 둔다.
  2. actualThis를 ? envRecord.GetThisBinding()으로 둔다.
  3. propertyKeyIdentifierNameStringValue로 둔다.
  4. strictIsStrict(this SuperProperty)로 둔다.
  5. MakeSuperPropertyReference(actualThis, propertyKey, strict)를 반환한다.
SuperCall : super Arguments
  1. newTargetGetNewTarget()으로 둔다.
  2. Assert: newTargetconstructor이다.
  3. superCtorGetSuperConstructor()로 둔다.
  4. argListArgumentsArgumentListEvaluation으로 ? 둔다.
  5. IsConstructor(superCtor)가 false이면, TypeError exception을 throw한다.
  6. result를 ? Construct(superCtor, argList, newTarget)로 둔다.
  7. thisERGetThisEnvironment()로 둔다.
  8. Assert: thisERFunction Environment Record이다.
  9. BindThisValue(thisER, result)를 수행한다.
  10. funcObjthisER.[[FunctionObject]]로 둔다.
  11. Assert: funcObj는 ECMAScript function object이다.
  12. InitializeInstanceElements(result, funcObj)를 수행한다.
  13. result를 반환한다.

13.3.7.2 GetSuperConstructor ( )

The abstract operation GetSuperConstructor takes no arguments and returns an Object or null. It performs the following steps when called:

  1. envRecordGetThisEnvironment()로 둔다.
  2. Assert: envRecordFunction Environment Record이다.
  3. activeFuncenvRecord.[[FunctionObject]]로 둔다.
  4. Assert: activeFunc는 ECMAScript function object이다.
  5. superCtor를 ! activeFunc.[[GetPrototypeOf]]()로 둔다.
  6. superCtor를 반환한다.

13.3.7.3 MakeSuperPropertyReference ( actualThis, propertyKey, strict )

The abstract operation MakeSuperPropertyReference takes arguments actualThis (an ECMAScript language value), propertyKey (an ECMAScript language value), and strict (a Boolean) and returns a Super Reference Record. It performs the following steps when called:

  1. envRecordGetThisEnvironment()로 둔다.
  2. Assert: envRecord.HasSuperBinding()은 true이다.
  3. Assert: envRecordFunction Environment Record이다.
  4. baseValueGetSuperBase(envRecord)로 둔다.
  5. Reference Record { [[Base]]: baseValue, [[ReferencedName]]: propertyKey, [[Strict]]: strict, [[ThisValue]]: actualThis }를 반환한다.

13.3.8 Argument Lists

Note

argument list의 evaluation은 value의 List를 produce합니다.

13.3.8.1 Runtime Semantics: ArgumentListEvaluation

The syntax-directed operation ArgumentListEvaluation takes no arguments and returns either a normal completion containing a List of ECMAScript language values or an abrupt completion. It is defined piecewise over the following productions:

Arguments : ( )
  1. 새 empty List를 반환한다.
ArgumentList : AssignmentExpression
  1. refAssignmentExpressionEvaluation으로 ? 둔다.
  2. arg를 ? GetValue(ref)로 둔다.
  3. « arg »를 반환한다.
ArgumentList : ... AssignmentExpression
  1. list를 새 empty List로 둔다.
  2. spreadRefAssignmentExpressionEvaluation으로 ? 둔다.
  3. spreadObj를 ? GetValue(spreadRef)로 둔다.
  4. iteratorRecord를 ? GetIterator(spreadObj, sync)로 둔다.
  5. Repeat,
    1. next를 ? IteratorStepValue(iteratorRecord)로 둔다.
    2. nextdone이면, list를 반환한다.
    3. nextlist에 append한다.
ArgumentList : ArgumentList , AssignmentExpression
  1. precedingArgsArgumentListArgumentListEvaluation으로 ? 둔다.
  2. refAssignmentExpressionEvaluation으로 ? 둔다.
  3. arg를 ? GetValue(ref)로 둔다.
  4. precedingArgs와 « arg »의 list-concatenation을 반환한다.
ArgumentList : ArgumentList , ... AssignmentExpression
  1. precedingArgsArgumentListArgumentListEvaluation으로 ? 둔다.
  2. spreadRefAssignmentExpressionEvaluation으로 ? 둔다.
  3. iteratorRecord를 ? GetIterator(? GetValue(spreadRef), sync)로 둔다.
  4. Repeat,
    1. next를 ? IteratorStepValue(iteratorRecord)로 둔다.
    2. nextdone이면, precedingArgs를 반환한다.
    3. nextprecedingArgs에 append한다.
TemplateLiteral : NoSubstitutionTemplate
  1. templateLiteral을 this TemplateLiteral로 둔다.
  2. siteObjGetTemplateObject(templateLiteral)로 둔다.
  3. « siteObj »를 반환한다.
TemplateLiteral : SubstitutionTemplate
  1. templateLiteral을 this TemplateLiteral로 둔다.
  2. siteObjGetTemplateObject(templateLiteral)로 둔다.
  3. remainingSubstitutionTemplateArgumentListEvaluation으로 ? 둔다.
  4. « siteObj »와 remaininglist-concatenation을 반환한다.
SubstitutionTemplate : TemplateHead Expression TemplateSpans
  1. firstSubRefExpressionEvaluation으로 ? 둔다.
  2. firstSub를 ? GetValue(firstSubRef)로 둔다.
  3. restSubTemplateSpansSubstitutionEvaluation으로 ? 둔다.
  4. Assert: restSub는 possibly empty List이다.
  5. « firstSub »와 restSublist-concatenation을 반환한다.

13.3.9 Optional Chains

Note
optional chain은 하나 이상의 property access와 function call의 chain이며, 그 first는 token ?.로 시작합니다.

13.3.9.1 Runtime Semantics: Evaluation

OptionalExpression : MemberExpression OptionalChain
  1. baseRefMemberExpressionEvaluation으로 ? 둔다.
  2. baseValue를 ? GetValue(baseRef)로 둔다.
  3. baseValueundefined 또는 null이면, 다음을 수행한다.
    1. undefined를 반환한다.
  4. arguments baseValuebaseRef를 가진 OptionalChainChainEvaluation을 ? 반환한다.
OptionalExpression : CallExpression OptionalChain
  1. baseRefCallExpressionEvaluation으로 ? 둔다.
  2. baseValue를 ? GetValue(baseRef)로 둔다.
  3. baseValueundefined 또는 null이면, 다음을 수행한다.
    1. undefined를 반환한다.
  4. arguments baseValuebaseRef를 가진 OptionalChainChainEvaluation을 ? 반환한다.
OptionalExpression : OptionalExpression OptionalChain
  1. baseRefOptionalExpressionEvaluation으로 ? 둔다.
  2. baseValue를 ? GetValue(baseRef)로 둔다.
  3. baseValueundefined 또는 null이면, 다음을 수행한다.
    1. undefined를 반환한다.
  4. arguments baseValuebaseRef를 가진 OptionalChainChainEvaluation을 ? 반환한다.

13.3.9.2 Runtime Semantics: ChainEvaluation

The syntax-directed operation ChainEvaluation takes arguments baseValue (an ECMAScript language value) and baseRef (an ECMAScript language value or a Reference Record) and returns either a normal completion containing either an ECMAScript language value or a Reference Record, or an abrupt completion. It is defined piecewise over the following productions:

OptionalChain : ?. Arguments
  1. thisChain을 this OptionalChain로 둔다.
  2. tailCallIsInTailPosition(thisChain)으로 둔다.
  3. EvaluateCall(baseValue, baseRef, Arguments, tailCall)를 반환한다.
OptionalChain : ?. [ Expression ]
  1. strictIsStrict(this OptionalChain)로 둔다.
  2. EvaluatePropertyAccessWithExpressionKey(baseValue, Expression, strict)를 반환한다.
OptionalChain : ?. IdentifierName
  1. strictIsStrict(this OptionalChain)로 둔다.
  2. EvaluatePropertyAccessWithIdentifierKey(baseValue, IdentifierName, strict)를 반환한다.
OptionalChain : ?. PrivateIdentifier
  1. fieldNameStringPrivateIdentifierStringValue로 둔다.
  2. MakePrivateReference(baseValue, fieldNameString)를 반환한다.
OptionalChain : OptionalChain Arguments
  1. optionalChainOptionalChain로 둔다.
  2. newRef를 arguments baseValuebaseRef를 가진 optionalChainChainEvaluation으로 ? 둔다.
  3. newValue를 ? GetValue(newRef)로 둔다.
  4. thisChain을 this OptionalChain로 둔다.
  5. tailCallIsInTailPosition(thisChain)으로 둔다.
  6. EvaluateCall(newValue, newRef, Arguments, tailCall)를 반환한다.
OptionalChain : OptionalChain [ Expression ]
  1. optionalChainOptionalChain로 둔다.
  2. newRef를 arguments baseValuebaseRef를 가진 optionalChainChainEvaluation으로 ? 둔다.
  3. newValue를 ? GetValue(newRef)로 둔다.
  4. strictIsStrict(this OptionalChain)로 둔다.
  5. EvaluatePropertyAccessWithExpressionKey(newValue, Expression, strict)를 반환한다.
OptionalChain : OptionalChain . IdentifierName
  1. optionalChainOptionalChain로 둔다.
  2. newRef를 arguments baseValuebaseRef를 가진 optionalChainChainEvaluation으로 ? 둔다.
  3. newValue를 ? GetValue(newRef)로 둔다.
  4. strictIsStrict(this OptionalChain)로 둔다.
  5. EvaluatePropertyAccessWithIdentifierKey(newValue, IdentifierName, strict)를 반환한다.
OptionalChain : OptionalChain . PrivateIdentifier
  1. optionalChainOptionalChain로 둔다.
  2. newRef를 arguments baseValuebaseRef를 가진 optionalChainChainEvaluation으로 ? 둔다.
  3. newValue를 ? GetValue(newRef)로 둔다.
  4. fieldNameStringPrivateIdentifierStringValue로 둔다.
  5. MakePrivateReference(newValue, fieldNameString)를 반환한다.

13.3.10 Import Calls

13.3.10.1 Runtime Semantics: Evaluation

ImportCall : import ( AssignmentExpression ,opt )
  1. EvaluateImportCall(AssignmentExpression)를 반환한다.
ImportCall : import ( AssignmentExpression , AssignmentExpression ,opt )
  1. EvaluateImportCall(first AssignmentExpression, second AssignmentExpression)를 반환한다.

13.3.10.2 EvaluateImportCall ( specifierExpr [ , optionsExpr ] )

The abstract operation EvaluateImportCall takes argument specifierExpr (a Parse Node) and optional argument optionsExpr (a Parse Node) and returns either a normal completion containing a Promise or an abrupt completion. It performs the following steps when called:

  1. referrerGetActiveScriptOrModule()로 둔다.
  2. referrernull이면, referrer를 current Realm Record로 설정한다.
  3. specifierRefspecifierExprEvaluation으로 ? 둔다.
  4. specifier를 ? GetValue(specifierRef)로 둔다.
  5. optionsExpr가 present하면, 다음을 수행한다.
    1. optionsRefoptionsExprEvaluation으로 ? 둔다.
    2. options를 ? GetValue(optionsRef)로 둔다.
  6. 그렇지 않으면,
    1. optionsundefined로 둔다.
  7. promiseCapability를 ! NewPromiseCapability(%Promise%)로 둔다.
  8. specifierStringCompletion(ToString(specifier))으로 둔다.
  9. IfAbruptRejectPromise(specifierString, promiseCapability).
  10. attrs를 새 empty List로 둔다.
  11. optionsundefined가 아니면, 다음을 수행한다.
    1. options가 Object가 아니면, 다음을 수행한다.
      1. Call(promiseCapability.[[Reject]], undefined, « newly created TypeError object »)를 수행한다.
      2. promiseCapability.[[Promise]]를 반환한다.
    2. attrsObjCompletion(Get(options, "with"))로 둔다.
    3. IfAbruptRejectPromise(attrsObj, promiseCapability).
    4. attrsObjundefined가 아니면, 다음을 수행한다.
      1. attrsObj가 Object가 아니면, 다음을 수행한다.
        1. Call(promiseCapability.[[Reject]], undefined, « newly created TypeError object »)를 수행한다.
        2. promiseCapability.[[Promise]]를 반환한다.
      2. entriesCompletion(EnumerableOwnProperties(attrsObj, key+value))로 둔다.
      3. IfAbruptRejectPromise(entries, promiseCapability).
      4. entries의 각 element entry에 대해, 다음을 수행한다.
        1. key를 ! Get(entry, "0")로 둔다.
        2. value를 ! Get(entry, "1")로 둔다.
        3. key가 String이면, 다음을 수행한다.
          1. value가 String이 아니면, 다음을 수행한다.
            1. Call(promiseCapability.[[Reject]], undefined, « newly created TypeError object »)를 수행한다.
            2. promiseCapability.[[Promise]]를 반환한다.
          2. ImportAttribute Record { [[Key]]: key, [[Value]]: value }를 attrs에 append한다.
    5. AllImportAttributesSupported(attrs)가 false이면, 다음을 수행한다.
      1. Call(promiseCapability.[[Reject]], undefined, « newly created TypeError object »)를 수행한다.
      2. promiseCapability.[[Promise]]를 반환한다.
    6. [[Key]] field의 value를 UTF-16 code unit value의 sequence로 treating하여, [[Key]] field의 lexicographic order에 따라 attrs를 sort한다. NOTE: 이 sorting은 host가 attribute가 enumerated된 order에 based하여 behaviour를 change하는 것이 prohibited된다는 점에서만 observable합니다.
  12. moduleRequest를 새 ModuleRequest Record { [[Specifier]]: specifierString, [[Attributes]]: attrs }로 둔다.
  13. HostLoadImportedModule(referrer, moduleRequest, empty, promiseCapability)를 수행한다.
  14. promiseCapability.[[Promise]]를 반환한다.

13.3.10.3 ContinueDynamicImport ( promiseCapability, moduleCompletion )

The abstract operation ContinueDynamicImport takes arguments promiseCapability (a PromiseCapability Record) and moduleCompletion (either a normal completion containing a Module Record or a throw completion) and returns unused. import() call에 의해 originally started된 dynamic import process를 complete하여, 해당 call이 반환한 promise를 appropriate하게 resolving하거나 rejecting합니다. It performs the following steps when called:

  1. moduleCompletionabrupt completion이면, 다음을 수행한다.
    1. Call(promiseCapability.[[Reject]], undefined, « moduleCompletion.[[Value]] »)를 수행한다.
    2. unused를 반환한다.
  2. modulemoduleCompletion.[[Value]]로 둔다.
  3. loadPromisemodule.LoadRequestedModules()로 둔다.
  4. rejectedClosurepromiseCapability를 capture하고 called될 때 다음 step을 수행하는, parameter (reason)를 가진 새 Abstract Closure로 둔다:
    1. Call(promiseCapability.[[Reject]], undefined, « reason »)를 수행한다.
    2. NormalCompletion(undefined)를 반환한다.
  5. onRejectedCreateBuiltinFunction(rejectedClosure, 1, "", « »)로 둔다.
  6. linkAndEvaluateClosuremodule, promiseCapability, onRejected를 capture하고 called될 때 다음 step을 수행하는, parameter가 없는 새 Abstract Closure로 둔다:
    1. linkCompletion(module.Link())로 둔다.
    2. linkabrupt completion이면, 다음을 수행한다.
      1. Call(promiseCapability.[[Reject]], undefined, « link.[[Value]] »)를 수행한다.
      2. NormalCompletion(undefined)를 반환한다.
    3. evaluatePromisemodule.Evaluate()로 둔다.
    4. fulfilledClosuremodulepromiseCapability를 capture하고 called될 때 다음 step을 수행하는, parameter가 없는 새 Abstract Closure로 둔다:
      1. namespaceGetModuleNamespace(module)로 둔다.
      2. Call(promiseCapability.[[Resolve]], undefined, « namespace »)를 수행한다.
      3. NormalCompletion(undefined)를 반환한다.
    5. onFulfilledCreateBuiltinFunction(fulfilledClosure, 0, "", « »)로 둔다.
    6. PerformPromiseThen(evaluatePromise, onFulfilled, onRejected)를 수행한다.
    7. unused를 반환한다.
  7. linkAndEvaluateCreateBuiltinFunction(linkAndEvaluateClosure, 0, "", « »)로 둔다.
  8. PerformPromiseThen(loadPromise, linkAndEvaluate, onRejected)를 수행한다.
  9. unused를 반환한다.

13.3.11 Tagged Templates

Note

tagged template은 call의 argument가 TemplateLiteral(13.2.8)에서 derived되는 function call입니다. actual argument에는 template object(13.2.8.4)와 TemplateLiteral 안에 embedded된 expression을 evaluating하여 produced된 value가 포함됩니다.

13.3.11.1 Runtime Semantics: Evaluation

MemberExpression : MemberExpression TemplateLiteral
  1. tagRefMemberExpressionEvaluation으로 ? 둔다.
  2. tagFunc를 ? GetValue(tagRef)로 둔다.
  3. thisCall을 this MemberExpression로 둔다.
  4. tailCallIsInTailPosition(thisCall)으로 둔다.
  5. EvaluateCall(tagFunc, tagRef, TemplateLiteral, tailCall)를 반환한다.
CallExpression : CallExpression TemplateLiteral
  1. tagRefCallExpressionEvaluation으로 ? 둔다.
  2. tagFunc를 ? GetValue(tagRef)로 둔다.
  3. thisCall을 this CallExpression로 둔다.
  4. tailCallIsInTailPosition(thisCall)으로 둔다.
  5. EvaluateCall(tagFunc, tagRef, TemplateLiteral, tailCall)를 반환한다.

13.3.12 Meta Properties

13.3.12.1 Runtime Semantics: Evaluation

NewTarget : new . target
  1. GetNewTarget()을 반환한다.
ImportMeta : import . meta
  1. moduleGetActiveScriptOrModule()로 둔다.
  2. Assert: moduleSource Text Module Record이다.
  3. importMetamodule.[[ImportMeta]]로 둔다.
  4. importMetaempty이면, 다음을 수행한다.
    1. importMetaOrdinaryObjectCreate(null)로 설정한다.
    2. importMetaValuesHostGetImportMetaProperties(module)로 둔다.
    3. importMetaValues의 각 Record { [[Key]], [[Value]] } entry에 대해, 다음을 수행한다.
      1. CreateDataPropertyOrThrow(importMeta, entry.[[Key]], entry.[[Value]])를 수행한다.
    4. HostFinalizeImportMeta(importMeta, module)를 수행한다.
    5. module.[[ImportMeta]]importMeta로 설정한다.
    6. importMeta를 반환한다.
  5. Assert: importMeta는 Object이다.
  6. importMeta를 반환한다.

13.3.12.1.1 HostGetImportMetaProperties ( moduleRecord )

The host-defined abstract operation HostGetImportMetaProperties takes argument moduleRecord (a Module Record) and returns a List of Records with fields [[Key]] (a property key) and [[Value]] (an ECMAScript language value). hostimport.meta에서 반환된 object를 위한 property key와 value를 provide할 수 있게 합니다.

HostGetImportMetaProperties의 default implementation은 새 empty List를 반환하는 것입니다.

13.3.12.1.2 HostFinalizeImportMeta ( importMeta, moduleRecord )

The host-defined abstract operation HostFinalizeImportMeta takes arguments importMeta (an Object) and moduleRecord (a Module Record) and returns unused. hostimport.meta에서 반환된 object를 prepare하기 위해 extraordinary operation을 perform할 수 있게 합니다.

대부분의 host는 단순히 HostGetImportMetaProperties를 define하고, HostFinalizeImportMeta를 default behaviour로 leave할 수 있습니다. 그러나 HostFinalizeImportMeta는 ECMAScript code에 exposed되기 전에 object를 직접 manipulate해야 하는 host를 위한 “escape hatch”를 제공합니다.

HostFinalizeImportMeta의 default implementation은 unused를 반환하는 것입니다.

13.4 Update Expressions

Syntax

UpdateExpression[Yield, Await] : LeftHandSideExpression[?Yield, ?Await] LeftHandSideExpression[?Yield, ?Await] [no LineTerminator here] ++ LeftHandSideExpression[?Yield, ?Await] [no LineTerminator here] -- ++ UnaryExpression[?Yield, ?Await] -- UnaryExpression[?Yield, ?Await]

13.4.1 Static Semantics: Early Errors

UpdateExpression : LeftHandSideExpression ++ LeftHandSideExpression -- UpdateExpression : ++ UnaryExpression -- UnaryExpression

13.4.2 Postfix Increment Operator

13.4.2.1 Runtime Semantics: Evaluation

UpdateExpression : LeftHandSideExpression ++
  1. lhsLeftHandSideExpressionEvaluation으로 ? 둔다.
  2. LeftHandSideExpressionAssignmentTargetTypeweb-compat이면, ReferenceError exception을 throw한다.
  3. oldValue를 ? ToNumeric(? GetValue(lhs))로 둔다.
  4. oldValue가 Number이면, 다음을 수행한다.
    1. newValueNumber::add(oldValue, 1𝔽)로 둔다.
  5. 그렇지 않으면,
    1. Assert: oldValue는 BigInt이다.
    2. newValueBigInt::add(oldValue, 1)로 둔다.
  6. PutValue(lhs, newValue)를 수행한다.
  7. oldValue를 반환한다.

13.4.3 Postfix Decrement Operator

13.4.3.1 Runtime Semantics: Evaluation

UpdateExpression : LeftHandSideExpression --
  1. lhsLeftHandSideExpressionEvaluation으로 ? 둔다.
  2. LeftHandSideExpressionAssignmentTargetTypeweb-compat이면, ReferenceError exception을 throw한다.
  3. oldValue를 ? ToNumeric(? GetValue(lhs))로 둔다.
  4. oldValue가 Number이면, 다음을 수행한다.
    1. newValueNumber::subtract(oldValue, 1𝔽)로 둔다.
  5. 그렇지 않으면,
    1. Assert: oldValue는 BigInt이다.
    2. newValueBigInt::subtract(oldValue, 1)로 둔다.
  6. PutValue(lhs, newValue)를 수행한다.
  7. oldValue를 반환한다.

13.4.4 Prefix Increment Operator

13.4.4.1 Runtime Semantics: Evaluation

UpdateExpression : ++ UnaryExpression
  1. exprUnaryExpressionEvaluation으로 ? 둔다.
  2. UnaryExpressionAssignmentTargetTypeweb-compat이면, ReferenceError exception을 throw한다.
  3. oldValue를 ? ToNumeric(? GetValue(expr))로 둔다.
  4. oldValue가 Number이면, 다음을 수행한다.
    1. newValueNumber::add(oldValue, 1𝔽)로 둔다.
  5. 그렇지 않으면,
    1. Assert: oldValue는 BigInt이다.
    2. newValueBigInt::add(oldValue, 1)로 둔다.
  6. PutValue(expr, newValue)를 수행한다.
  7. newValue를 반환한다.

13.4.5 Prefix Decrement Operator

13.4.5.1 Runtime Semantics: Evaluation

UpdateExpression : -- UnaryExpression
  1. exprUnaryExpressionEvaluation으로 ? 둔다.
  2. UnaryExpressionAssignmentTargetTypeweb-compat이면, ReferenceError exception을 throw한다.
  3. oldValue를 ? ToNumeric(? GetValue(expr))로 둔다.
  4. oldValue가 Number이면, 다음을 수행한다.
    1. newValueNumber::subtract(oldValue, 1𝔽)로 둔다.
  5. 그렇지 않으면,
    1. Assert: oldValue는 BigInt이다.
    2. newValueBigInt::subtract(oldValue, 1)로 둔다.
  6. PutValue(expr, newValue)를 수행한다.
  7. newValue를 반환한다.

13.5 Unary Operators

Syntax

UnaryExpression[Yield, Await] : UpdateExpression[?Yield, ?Await] delete UnaryExpression[?Yield, ?Await] void UnaryExpression[?Yield, ?Await] typeof UnaryExpression[?Yield, ?Await] + UnaryExpression[?Yield, ?Await] - UnaryExpression[?Yield, ?Await] ~ UnaryExpression[?Yield, ?Await] ! UnaryExpression[?Yield, ?Await] [+Await] CoverAwaitExpressionAndAwaitUsingDeclarationHead[?Yield] CoverAwaitExpressionAndAwaitUsingDeclarationHead[Yield] : await UnaryExpression[?Yield, +Await]

보충 구문

생성식의 인스턴스를 처리할 때
UnaryExpression : CoverAwaitExpressionAndAwaitUsingDeclarationHead
CoverAwaitExpressionAndAwaitUsingDeclarationHead의 해석은 다음 문법을 사용하여 정제된다:

AwaitExpression[Yield] : await UnaryExpression[?Yield, +Await]

13.5.1 delete Operator

13.5.1.1 Static Semantics: Early Errors

UnaryExpression : delete UnaryExpression Note

last rule은 delete (((foo))) 같은 expression이 first rule의 recursive application 때문에 early error를 produce한다는 의미입니다.

13.5.1.2 Runtime Semantics: Evaluation

UnaryExpression : delete UnaryExpression
  1. refUnaryExpressionEvaluation으로 ? 둔다.
  2. refReference Record가 아니면, true를 반환한다.
  3. IsUnresolvableReference(ref)가 true이면, 다음을 수행한다.
    1. Assert: ref.[[Strict]]false이다.
    2. true를 반환한다.
  4. IsPropertyReference(ref)가 true이면, 다음을 수행한다.
    1. Assert: IsPrivateReference(ref)는 false이다.
    2. IsSuperReference(ref)가 true이면, ReferenceError exception을 throw한다.
    3. baseObj를 ? ToObject(ref.[[Base]])로 둔다.
    4. ref.[[ReferencedName]]property key가 아니면, 다음을 수행한다.
      1. ref.[[ReferencedName]]을 ? ToPropertyKey(ref.[[ReferencedName]])로 설정한다.
    5. deleteStatus를 ? baseObj.[[Delete]](ref.[[ReferencedName]])로 둔다.
    6. deleteStatusfalse이고 ref.[[Strict]]true이면, TypeError exception을 throw한다.
    7. deleteStatus를 반환한다.
  5. baseref.[[Base]]로 둔다.
  6. Assert: baseEnvironment Record이다.
  7. base.DeleteBinding(ref.[[ReferencedName]])를 반환한다.
Note 1

delete operator가 strict mode code 안에 occur할 때, 그 UnaryExpression이 variable, function argument 또는 function name에 대한 direct reference이면 SyntaxError exception이 throw됩니다. 또한 delete operator가 strict mode code 안에 occur하고 deleted될 property가 attribute { [[Configurable]]: false }를 가지면(또는 otherwise deleted될 수 없으면), TypeError exception이 throw됩니다.

Note 2

step 4.c에서 created될 수 있는 object는 위 abstract operation과 ordinary object [[Delete]] internal method 밖에서는 accessible하지 않습니다. implementation은 그 object의 actual creation을 avoid하도록 choose할 수 있습니다.

13.5.2 void Operator

13.5.2.1 Runtime Semantics: Evaluation

UnaryExpression : void UnaryExpression
  1. exprUnaryExpressionEvaluation으로 ? 둔다.
  2. GetValue(expr)를 수행한다.
  3. undefined를 반환한다.
Note

value가 사용되지 않더라도 observable side-effect가 있을 수 있으므로 GetValue가 called되어야 합니다.

13.5.3 typeof Operator

13.5.3.1 Runtime Semantics: Evaluation

UnaryExpression : typeof UnaryExpression
  1. valueUnaryExpressionEvaluation으로 ? 둔다.
  2. valueReference Record이면, 다음을 수행한다.
    1. IsUnresolvableReference(value)가 true이면, "undefined"를 반환한다.
  3. value를 ? GetValue(value)로 설정한다.
  4. valueundefined이면, "undefined"를 반환한다.
  5. valuenull이면, "object"를 반환한다.
  6. value가 String이면, "string"을 반환한다.
  7. value가 Symbol이면, "symbol"을 반환한다.
  8. value가 Boolean이면, "boolean"을 반환한다.
  9. value가 Number이면, "number"를 반환한다.
  10. value가 BigInt이면, "bigint"를 반환한다.
  11. Assert: value는 Object이다.
  12. host가 web browser이거나 그 밖에 [[IsHTMLDDA]] Internal Slot를 support하면, 다음을 수행한다.
    1. value[[IsHTMLDDA]] internal slot을 가지면, "undefined"를 반환한다.
  13. value[[Call]] internal method를 가지면, "function"을 반환한다.
  14. "object"를 반환한다.

13.5.4 Unary + Operator

Note

unary + operator는 그 operand를 Number type으로 convert합니다.

13.5.4.1 Runtime Semantics: Evaluation

UnaryExpression : + UnaryExpression
  1. exprUnaryExpressionEvaluation으로 ? 둔다.
  2. ToNumber(? GetValue(expr))를 반환한다.

13.5.5 Unary - Operator

Note

unary - operator는 그 operand를 numeric value로 convert한 다음 negate합니다. +0𝔽를 negating하면 -0𝔽가 produce되고, -0𝔽를 negating하면 +0𝔽가 produce됩니다.

13.5.5.1 Runtime Semantics: Evaluation

UnaryExpression : - UnaryExpression
  1. exprUnaryExpressionEvaluation으로 ? 둔다.
  2. oldValue를 ? ToNumeric(? GetValue(expr))로 둔다.
  3. oldValue가 Number이면, Number::unaryMinus(oldValue)를 반환한다.
  4. Assert: oldValue는 BigInt이다.
  5. BigInt::unaryMinus(oldValue)를 반환한다.

13.5.6 Bitwise NOT Operator ( ~ )

13.5.6.1 Runtime Semantics: Evaluation

UnaryExpression : ~ UnaryExpression
  1. exprUnaryExpressionEvaluation으로 ? 둔다.
  2. oldValue를 ? ToNumeric(? GetValue(expr))로 둔다.
  3. oldValue가 Number이면, Number::bitwiseNOT(oldValue)를 반환한다.
  4. Assert: oldValue는 BigInt이다.
  5. BigInt::bitwiseNOT(oldValue)를 반환한다.

13.5.7 Logical NOT Operator ( ! )

13.5.7.1 Runtime Semantics: Evaluation

UnaryExpression : ! UnaryExpression
  1. exprUnaryExpressionEvaluation으로 ? 둔다.
  2. oldValueToBoolean(? GetValue(expr))로 둔다.
  3. oldValuetrue이면, false를 반환한다.
  4. true를 반환한다.

13.6 Exponentiation Operator

Syntax

ExponentiationExpression[Yield, Await] : UnaryExpression[?Yield, ?Await] UpdateExpression[?Yield, ?Await] ** ExponentiationExpression[?Yield, ?Await]

13.6.1 Runtime Semantics: Evaluation

ExponentiationExpression : UpdateExpression ** ExponentiationExpression
  1. EvaluateStringOrNumericBinaryExpression(UpdateExpression, **, ExponentiationExpression)를 반환한다.

13.7 Multiplicative Operators

Syntax

MultiplicativeExpression[Yield, Await] : ExponentiationExpression[?Yield, ?Await] MultiplicativeExpression[?Yield, ?Await] MultiplicativeOperator ExponentiationExpression[?Yield, ?Await] MultiplicativeOperator : one of * / % Note
  • * operator는 multiplication을 수행하여 operand의 product를 produce합니다.
  • / operator는 division을 수행하여 operand의 quotient를 produce합니다.
  • % operator는 implied division에서 operand의 remainder를 yield합니다.

13.7.1 Runtime Semantics: Evaluation

MultiplicativeExpression : MultiplicativeExpression MultiplicativeOperator ExponentiationExpression
  1. opTextMultiplicativeOperator에 matched된 source text로 둔다.
  2. EvaluateStringOrNumericBinaryExpression(MultiplicativeExpression, opText, ExponentiationExpression)를 반환한다.

13.8 Additive Operators

Syntax

AdditiveExpression[Yield, Await] : MultiplicativeExpression[?Yield, ?Await] AdditiveExpression[?Yield, ?Await] + MultiplicativeExpression[?Yield, ?Await] AdditiveExpression[?Yield, ?Await] - MultiplicativeExpression[?Yield, ?Await]

13.8.1 Addition Operator ( + )

Note

addition operator는 string concatenation 또는 numeric addition을 수행합니다.

13.8.1.1 Runtime Semantics: Evaluation

AdditiveExpression : AdditiveExpression + MultiplicativeExpression
  1. EvaluateStringOrNumericBinaryExpression(AdditiveExpression, +, MultiplicativeExpression)를 반환한다.

13.8.2 Subtraction Operator ( - )

Note

- operator는 subtraction을 수행하여 operand의 difference를 produce합니다.

13.8.2.1 Runtime Semantics: Evaluation

AdditiveExpression : AdditiveExpression - MultiplicativeExpression
  1. EvaluateStringOrNumericBinaryExpression(AdditiveExpression, -, MultiplicativeExpression)를 반환한다.

13.9 Bitwise Shift Operators

Syntax

ShiftExpression[Yield, Await] : AdditiveExpression[?Yield, ?Await] ShiftExpression[?Yield, ?Await] << AdditiveExpression[?Yield, ?Await] ShiftExpression[?Yield, ?Await] >> AdditiveExpression[?Yield, ?Await] ShiftExpression[?Yield, ?Await] >>> AdditiveExpression[?Yield, ?Await]

13.9.1 Left Shift Operator ( << )

Note

left operand에 대해 right operand가 specified하는 amount만큼 bitwise left shift operation을 수행합니다.

13.9.1.1 Runtime Semantics: Evaluation

ShiftExpression : ShiftExpression << AdditiveExpression
  1. EvaluateStringOrNumericBinaryExpression(ShiftExpression, <<, AdditiveExpression)를 반환한다.

13.9.2 Signed Right Shift Operator ( >> )

Note

left operand에 대해 right operand가 specified하는 amount만큼 sign-filling bitwise right shift operation을 수행합니다.

13.9.2.1 Runtime Semantics: Evaluation

ShiftExpression : ShiftExpression >> AdditiveExpression
  1. EvaluateStringOrNumericBinaryExpression(ShiftExpression, >>, AdditiveExpression)를 반환한다.

13.9.3 Unsigned Right Shift Operator ( >>> )

Note

left operand에 대해 right operand가 specified하는 amount만큼 zero-filling bitwise right shift operation을 수행합니다.

13.9.3.1 Runtime Semantics: Evaluation

ShiftExpression : ShiftExpression >>> AdditiveExpression
  1. EvaluateStringOrNumericBinaryExpression(ShiftExpression, >>>, AdditiveExpression)를 반환한다.

13.10 Relational Operators

Note 1

relational operator를 evaluating한 result는 항상 Boolean type이며, operator가 named한 relationship이 두 operand 사이에서 holds하는지를 reflect합니다.

Syntax

RelationalExpression[In, Yield, Await] : ShiftExpression[?Yield, ?Await] RelationalExpression[?In, ?Yield, ?Await] < ShiftExpression[?Yield, ?Await] RelationalExpression[?In, ?Yield, ?Await] > ShiftExpression[?Yield, ?Await] RelationalExpression[?In, ?Yield, ?Await] <= ShiftExpression[?Yield, ?Await] RelationalExpression[?In, ?Yield, ?Await] >= ShiftExpression[?Yield, ?Await] RelationalExpression[?In, ?Yield, ?Await] instanceof ShiftExpression[?Yield, ?Await] [+In] RelationalExpression[+In, ?Yield, ?Await] in ShiftExpression[?Yield, ?Await] [+In] PrivateIdentifier in ShiftExpression[?Yield, ?Await] Note 2

[In] grammar parameter는 relational expression 안의 in operator와 for statement 안의 in operator를 confuse하는 것을 avoid하기 위해 필요합니다.

13.10.1 Runtime Semantics: Evaluation

RelationalExpression : RelationalExpression < ShiftExpression
  1. leftRefRelationalExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. rightRefShiftExpressionEvaluation으로 ? 둔다.
  4. rightValue를 ? GetValue(rightRef)로 둔다.
  5. result를 ? IsLessThan(leftValue, rightValue, true)로 둔다.
  6. resultundefined이면, false를 반환한다.
  7. result를 반환한다.
RelationalExpression : RelationalExpression > ShiftExpression
  1. leftRefRelationalExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. rightRefShiftExpressionEvaluation으로 ? 둔다.
  4. rightValue를 ? GetValue(rightRef)로 둔다.
  5. result를 ? IsLessThan(rightValue, leftValue, false)로 둔다.
  6. resultundefined이면, false를 반환한다.
  7. result를 반환한다.
RelationalExpression : RelationalExpression <= ShiftExpression
  1. leftRefRelationalExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. rightRefShiftExpressionEvaluation으로 ? 둔다.
  4. rightValue를 ? GetValue(rightRef)로 둔다.
  5. result를 ? IsLessThan(rightValue, leftValue, false)로 둔다.
  6. resulttrue 또는 undefined이면, false를 반환한다.
  7. true를 반환한다.
RelationalExpression : RelationalExpression >= ShiftExpression
  1. leftRefRelationalExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. rightRefShiftExpressionEvaluation으로 ? 둔다.
  4. rightValue를 ? GetValue(rightRef)로 둔다.
  5. result를 ? IsLessThan(leftValue, rightValue, true)로 둔다.
  6. resulttrue 또는 undefined이면, false를 반환한다.
  7. true를 반환한다.
RelationalExpression : RelationalExpression instanceof ShiftExpression
  1. leftRefRelationalExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. rightRefShiftExpressionEvaluation으로 ? 둔다.
  4. rightValue를 ? GetValue(rightRef)로 둔다.
  5. InstanceofOperator(leftValue, rightValue)를 반환한다.
RelationalExpression : RelationalExpression in ShiftExpression
  1. leftRefRelationalExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. rightRefShiftExpressionEvaluation으로 ? 둔다.
  4. rightValue를 ? GetValue(rightRef)로 둔다.
  5. rightValue가 Object가 아니면, TypeError exception을 throw한다.
  6. HasProperty(rightValue, ? ToPropertyKey(leftValue))를 반환한다.
RelationalExpression : PrivateIdentifier in ShiftExpression
  1. privateIdentifierPrivateIdentifierStringValue로 둔다.
  2. rightRefShiftExpressionEvaluation으로 ? 둔다.
  3. rightValue를 ? GetValue(rightRef)로 둔다.
  4. rightValue가 Object가 아니면, TypeError exception을 throw한다.
  5. privateEnvrunning execution context의 PrivateEnvironment로 둔다.
  6. Assert: privateEnvnull이 아니다.
  7. privateNameResolvePrivateIdentifier(privateEnv, privateIdentifier)로 둔다.
  8. PrivateElementFind(rightValue, privateName)가 empty이면, false를 반환한다.
  9. true를 반환한다.

13.10.2 InstanceofOperator ( value, target )

The abstract operation InstanceofOperator takes arguments value (an ECMAScript language value) and target (an ECMAScript language value) and returns either a normal completion containing a Boolean or a throw completion. target%Symbol.hasInstance% method를 consult하거나, 그것이 absent하면 target"prototype" property의 value가 value의 prototype chain 안에 present한지를 determine하여, valuetarget의 instance인지 determine하는 generic algorithm을 implements합니다. It performs the following steps when called:

  1. target이 Object가 아니면, TypeError exception을 throw한다.
  2. instOfHandler를 ? GetMethod(target, %Symbol.hasInstance%)로 둔다.
  3. instOfHandlerundefined가 아니면, 다음을 수행한다.
    1. ToBoolean(? Call(instOfHandler, target, « value »))를 반환한다.
  4. IsCallable(target)이 false이면, TypeError exception을 throw한다.
  5. OrdinaryHasInstance(target, value)를 반환한다.
Note

step 45instanceof operator semantics를 define하기 위해 %Symbol.hasInstance% method를 사용하지 않았던 ECMAScript의 previous edition과의 compatibility를 제공합니다. object가 %Symbol.hasInstance%를 define하거나 inherit하지 않으면 default instanceof semantics를 사용합니다.

13.11 Equality Operators

Note

equality operator를 evaluating한 result는 항상 Boolean type이며, operator가 named한 relationship이 두 operand 사이에서 holds하는지를 reflect합니다.

Syntax

EqualityExpression[In, Yield, Await] : RelationalExpression[?In, ?Yield, ?Await] EqualityExpression[?In, ?Yield, ?Await] == RelationalExpression[?In, ?Yield, ?Await] EqualityExpression[?In, ?Yield, ?Await] != RelationalExpression[?In, ?Yield, ?Await] EqualityExpression[?In, ?Yield, ?Await] === RelationalExpression[?In, ?Yield, ?Await] EqualityExpression[?In, ?Yield, ?Await] !== RelationalExpression[?In, ?Yield, ?Await]

13.11.1 Runtime Semantics: Evaluation

EqualityExpression : EqualityExpression == RelationalExpression
  1. leftRefEqualityExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. rightRefRelationalExpressionEvaluation으로 ? 둔다.
  4. rightValue를 ? GetValue(rightRef)로 둔다.
  5. IsLooselyEqual(rightValue, leftValue)를 반환한다.
EqualityExpression : EqualityExpression != RelationalExpression
  1. leftRefEqualityExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. rightRefRelationalExpressionEvaluation으로 ? 둔다.
  4. rightValue를 ? GetValue(rightRef)로 둔다.
  5. result를 ? IsLooselyEqual(rightValue, leftValue)로 둔다.
  6. resulttrue이면, false를 반환한다.
  7. true를 반환한다.
EqualityExpression : EqualityExpression === RelationalExpression
  1. leftRefEqualityExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. rightRefRelationalExpressionEvaluation으로 ? 둔다.
  4. rightValue를 ? GetValue(rightRef)로 둔다.
  5. IsStrictlyEqual(rightValue, leftValue)를 반환한다.
EqualityExpression : EqualityExpression !== RelationalExpression
  1. leftRefEqualityExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. rightRefRelationalExpressionEvaluation으로 ? 둔다.
  4. rightValue를 ? GetValue(rightRef)로 둔다.
  5. resultIsStrictlyEqual(rightValue, leftValue)로 둔다.
  6. resulttrue이면, false를 반환한다.
  7. true를 반환한다.
Note 1

equality operator는 다음 invariant를 maintain합니다:

  • A != B!(A == B)와 equivalent합니다.
  • A == BAB의 evaluation order를 제외하면 B == A와 equivalent합니다.
Note 2

equality operator는 항상 transitive하지는 않습니다. 예를 들어 같은 String value를 각각 representing하는 두 distinct String object가 있을 수 있습니다; 각 String object는 == operator에 의해 String value와 equal하다고 considered되지만, 두 String object는 서로 equal하지 않습니다. 예:

  • new String("a") == "a""a" == new String("a")는 모두 true입니다.
  • new String("a") == new String("a")false입니다.
Note 3

String의 comparison은 code unit value의 sequence에 대한 simple equality test를 사용합니다. Unicode specification에 defined된 character 또는 string equality 및 collating order의 더 complex하고 semantically oriented한 definition을 사용하려는 attempt는 없습니다. 따라서 Unicode Standard에 따라 canonically equal한 String value가 unequal로 test될 수 있습니다. 사실상 이 algorithm은 두 String이 이미 normalized form에 있다고 assume합니다.

13.12 Binary Bitwise Operators

Syntax

BitwiseANDExpression[In, Yield, Await] : EqualityExpression[?In, ?Yield, ?Await] BitwiseANDExpression[?In, ?Yield, ?Await] & EqualityExpression[?In, ?Yield, ?Await] BitwiseXORExpression[In, Yield, Await] : BitwiseANDExpression[?In, ?Yield, ?Await] BitwiseXORExpression[?In, ?Yield, ?Await] ^ BitwiseANDExpression[?In, ?Yield, ?Await] BitwiseORExpression[In, Yield, Await] : BitwiseXORExpression[?In, ?Yield, ?Await] BitwiseORExpression[?In, ?Yield, ?Await] | BitwiseXORExpression[?In, ?Yield, ?Await]

13.12.1 Runtime Semantics: Evaluation

BitwiseANDExpression : BitwiseANDExpression & EqualityExpression
  1. EvaluateStringOrNumericBinaryExpression(BitwiseANDExpression, &, EqualityExpression)를 반환한다.
BitwiseXORExpression : BitwiseXORExpression ^ BitwiseANDExpression
  1. EvaluateStringOrNumericBinaryExpression(BitwiseXORExpression, ^, BitwiseANDExpression)를 반환한다.
BitwiseORExpression : BitwiseORExpression | BitwiseXORExpression
  1. EvaluateStringOrNumericBinaryExpression(BitwiseORExpression, |, BitwiseXORExpression)를 반환한다.

13.13 Binary Logical Operators

Syntax

LogicalANDExpression[In, Yield, Await] : BitwiseORExpression[?In, ?Yield, ?Await] LogicalANDExpression[?In, ?Yield, ?Await] && BitwiseORExpression[?In, ?Yield, ?Await] LogicalORExpression[In, Yield, Await] : LogicalANDExpression[?In, ?Yield, ?Await] LogicalORExpression[?In, ?Yield, ?Await] || LogicalANDExpression[?In, ?Yield, ?Await] CoalesceExpression[In, Yield, Await] : CoalesceExpressionHead[?In, ?Yield, ?Await] ?? BitwiseORExpression[?In, ?Yield, ?Await] CoalesceExpressionHead[In, Yield, Await] : CoalesceExpression[?In, ?Yield, ?Await] BitwiseORExpression[?In, ?Yield, ?Await] ShortCircuitExpression[In, Yield, Await] : LogicalORExpression[?In, ?Yield, ?Await] CoalesceExpression[?In, ?Yield, ?Await] Note

&& 또는 || operator가 produced하는 value는 반드시 Boolean type일 필요는 없습니다. produced되는 value는 항상 두 operand expression 중 하나의 value입니다.

13.13.1 Runtime Semantics: Evaluation

LogicalANDExpression : LogicalANDExpression && BitwiseORExpression
  1. leftRefLogicalANDExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. ToBoolean(leftValue)가 false이면, leftValue를 반환한다.
  4. rightRefBitwiseORExpressionEvaluation으로 ? 둔다.
  5. GetValue(rightRef)를 반환한다.
LogicalORExpression : LogicalORExpression || LogicalANDExpression
  1. leftRefLogicalORExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. ToBoolean(leftValue)가 true이면, leftValue를 반환한다.
  4. rightRefLogicalANDExpressionEvaluation으로 ? 둔다.
  5. GetValue(rightRef)를 반환한다.
CoalesceExpression : CoalesceExpressionHead ?? BitwiseORExpression
  1. leftRefCoalesceExpressionHeadEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. leftValueundefinednull도 아니면, leftValue를 반환한다.
  4. rightRefBitwiseORExpressionEvaluation으로 ? 둔다.
  5. GetValue(rightRef)를 반환한다.

13.14 Conditional Operator ( ? : )

Syntax

ConditionalExpression[In, Yield, Await] : ShortCircuitExpression[?In, ?Yield, ?Await] ShortCircuitExpression[?In, ?Yield, ?Await] ? AssignmentExpression[+In, ?Yield, ?Await] : AssignmentExpression[?In, ?Yield, ?Await] Note

ECMAScript에서 ConditionalExpression의 grammar는 C 및 Java의 grammar와 약간 다릅니다. C와 Java는 second subexpression을 Expression으로 allow하지만 third expression은 ConditionalExpression으로 restrict합니다. ECMAScript에서 이 차이의 motivation은 conditional의 어느 arm이든 assignment expression에 의해 governed될 수 있도록 하고, centre expression으로서 comma expression이라는 confusing하고 fairly useless한 case를 eliminate하기 위한 것입니다.

13.14.1 Runtime Semantics: Evaluation

ConditionalExpression : ShortCircuitExpression ? AssignmentExpression : AssignmentExpression
  1. leftRefShortCircuitExpressionEvaluation으로 ? 둔다.
  2. leftValueToBoolean(? GetValue(leftRef))로 둔다.
  3. leftValuetrue이면, 다음을 수행한다.
    1. trueRef를 first AssignmentExpressionEvaluation으로 ? 둔다.
    2. GetValue(trueRef)를 반환한다.
  4. falseRef를 second AssignmentExpressionEvaluation으로 ? 둔다.
  5. GetValue(falseRef)를 반환한다.

13.15 Assignment Operators

Syntax

AssignmentExpression[In, Yield, Await] : ConditionalExpression[?In, ?Yield, ?Await] [+Yield] YieldExpression[?In, ?Await] ArrowFunction[?In, ?Yield, ?Await] AsyncArrowFunction[?In, ?Yield, ?Await] LeftHandSideExpression[?Yield, ?Await] = AssignmentExpression[?In, ?Yield, ?Await] LeftHandSideExpression[?Yield, ?Await] AssignmentOperator AssignmentExpression[?In, ?Yield, ?Await] LeftHandSideExpression[?Yield, ?Await] &&= AssignmentExpression[?In, ?Yield, ?Await] LeftHandSideExpression[?Yield, ?Await] ||= AssignmentExpression[?In, ?Yield, ?Await] LeftHandSideExpression[?Yield, ?Await] ??= AssignmentExpression[?In, ?Yield, ?Await] AssignmentOperator : one of *= /= %= += -= <<= >>= >>>= &= ^= |= **=

13.15.1 Static Semantics: Early Errors

AssignmentExpression : LeftHandSideExpression = AssignmentExpression AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression AssignmentExpression : LeftHandSideExpression &&= AssignmentExpression LeftHandSideExpression ||= AssignmentExpression LeftHandSideExpression ??= AssignmentExpression

13.15.2 Runtime Semantics: Evaluation

AssignmentExpression : LeftHandSideExpression = AssignmentExpression
  1. LeftHandSideExpressionObjectLiteralArrayLiteral도 아니면, 다음을 수행한다.
    1. leftRefLeftHandSideExpressionEvaluation으로 ? 둔다.
    2. LeftHandSideExpressionAssignmentTargetTypeweb-compat이면, ReferenceError exception을 throw한다.
    3. IsAnonymousFunctionDefinition(AssignmentExpression)이 true이고 LeftHandSideExpressionIsIdentifierReftrue이면, 다음을 수행한다.
      1. lhsLeftHandSideExpressionStringValue로 둔다.
      2. rightValue를 argument lhs를 가진 AssignmentExpressionNamedEvaluation으로 ? 둔다.
    4. 그렇지 않으면,
      1. rightRefAssignmentExpressionEvaluation으로 ? 둔다.
      2. rightValue를 ? GetValue(rightRef)로 둔다.
    5. PutValue(leftRef, rightValue)를 수행한다.
    6. rightValue를 반환한다.
  2. assignmentPatternLeftHandSideExpressioncovered하는 AssignmentPattern으로 둔다.
  3. rightRefAssignmentExpressionEvaluation으로 ? 둔다.
  4. rightValue를 ? GetValue(rightRef)로 둔다.
  5. argument rightValue를 가진 assignmentPatternDestructuringAssignmentEvaluation을 ? 수행한다.
  6. rightValue를 반환한다.
AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression
  1. leftRefLeftHandSideExpressionEvaluation으로 ? 둔다.
  2. LeftHandSideExpressionAssignmentTargetTypeweb-compat이면, ReferenceError exception을 throw한다.
  3. leftValue를 ? GetValue(leftRef)로 둔다.
  4. rightRefAssignmentExpressionEvaluation으로 ? 둔다.
  5. rightValue를 ? GetValue(rightRef)로 둔다.
  6. assignmentOpTextAssignmentOperator에 matched된 source text로 둔다.
  7. opText를 다음 table에서 assignmentOpText와 associated된 Unicode code point의 sequence로 둔다:
    assignmentOpText opText
    **= **
    *= *
    /= /
    %= %
    += +
    -= -
    <<= <<
    >>= >>
    >>>= >>>
    &= &
    ^= ^
    |= |
  8. result를 ? ApplyStringOrNumericBinaryOperator(leftValue, opText, rightValue)로 둔다.
  9. PutValue(leftRef, result)를 수행한다.
  10. result를 반환한다.
AssignmentExpression : LeftHandSideExpression &&= AssignmentExpression
  1. leftRefLeftHandSideExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. ToBoolean(leftValue)가 false이면, leftValue를 반환한다.
  4. IsAnonymousFunctionDefinition(AssignmentExpression)이 true이고 LeftHandSideExpressionIsIdentifierReftrue이면, 다음을 수행한다.
    1. lhsLeftHandSideExpressionStringValue로 둔다.
    2. rightValue를 argument lhs를 가진 AssignmentExpressionNamedEvaluation으로 ? 둔다.
  5. 그렇지 않으면,
    1. rightRefAssignmentExpressionEvaluation으로 ? 둔다.
    2. rightValue를 ? GetValue(rightRef)로 둔다.
  6. PutValue(leftRef, rightValue)를 수행한다.
  7. rightValue를 반환한다.
AssignmentExpression : LeftHandSideExpression ||= AssignmentExpression
  1. leftRefLeftHandSideExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. ToBoolean(leftValue)가 true이면, leftValue를 반환한다.
  4. IsAnonymousFunctionDefinition(AssignmentExpression)이 true이고 LeftHandSideExpressionIsIdentifierReftrue이면, 다음을 수행한다.
    1. lhsLeftHandSideExpressionStringValue로 둔다.
    2. rightValue를 argument lhs를 가진 AssignmentExpressionNamedEvaluation으로 ? 둔다.
  5. 그렇지 않으면,
    1. rightRefAssignmentExpressionEvaluation으로 ? 둔다.
    2. rightValue를 ? GetValue(rightRef)로 둔다.
  6. PutValue(leftRef, rightValue)를 수행한다.
  7. rightValue를 반환한다.
AssignmentExpression : LeftHandSideExpression ??= AssignmentExpression
  1. leftRefLeftHandSideExpressionEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. leftValueundefinednull도 아니면, leftValue를 반환한다.
  4. IsAnonymousFunctionDefinition(AssignmentExpression)이 true이고 LeftHandSideExpressionIsIdentifierReftrue이면, 다음을 수행한다.
    1. lhsLeftHandSideExpressionStringValue로 둔다.
    2. rightValue를 argument lhs를 가진 AssignmentExpressionNamedEvaluation으로 ? 둔다.
  5. 그렇지 않으면,
    1. rightRefAssignmentExpressionEvaluation으로 ? 둔다.
    2. rightValue를 ? GetValue(rightRef)로 둔다.
  6. PutValue(leftRef, rightValue)를 수행한다.
  7. rightValue를 반환한다.
Note

이 expression이 strict mode code 안에 occur할 때, step 1.e, 3, 2, 2, 2leftRef가 unresolvable reference이면 runtime error입니다. 그러한 경우 ReferenceError exception이 throw됩니다. 추가로, step 9, 6, 6, 6leftRef가 attribute value { [[Writable]]: false }를 가진 data property에 대한 reference이거나, attribute value { [[Set]]: undefined }를 가진 accessor property에 대한 reference이거나, IsExtensible predicate가 value false를 반환하는 object의 non-existent property에 대한 reference이면 runtime error입니다. 이러한 경우 TypeError exception이 throw됩니다.

13.15.3 ApplyStringOrNumericBinaryOperator ( leftValue, opText, rightValue )

The abstract operation ApplyStringOrNumericBinaryOperator takes arguments leftValue (an ECMAScript language value), opText (**, *, /, %, +, -, <<, >>, >>>, &, ^, or |), and rightValue (an ECMAScript language value) and returns either a normal completion containing either a String, a BigInt, or a Number, or a throw completion. It performs the following steps when called:

  1. opText+이면, 다음을 수행한다.
    1. leftPrimitive를 ? ToPrimitive(leftValue)로 둔다.
    2. rightPrimitive를 ? ToPrimitive(rightValue)로 둔다.
    3. leftPrimitive가 String이거나 rightPrimitive가 String이면, 다음을 수행한다.
      1. leftString을 ? ToString(leftPrimitive)로 둔다.
      2. rightString을 ? ToString(rightPrimitive)로 둔다.
      3. leftStringrightStringstring-concatenation을 반환한다.
    4. leftValueleftPrimitive로 설정한다.
    5. rightValuerightPrimitive로 설정한다.
  2. NOTE: 이 시점에서는 numeric operation이어야 한다.
  3. leftNumber를 ? ToNumeric(leftValue)로 둔다.
  4. rightNumber를 ? ToNumeric(rightValue)로 둔다.
  5. SameType(leftNumber, rightNumber)이 false이면, TypeError exception을 throw한다.
  6. leftNumber가 BigInt이면, 다음을 수행한다.
    1. opText**이면, ? BigInt::exponentiate(leftNumber, rightNumber)를 반환한다.
    2. opText/이면, ? BigInt::divide(leftNumber, rightNumber)를 반환한다.
    3. opText%이면, ? BigInt::remainder(leftNumber, rightNumber)를 반환한다.
    4. opText>>>이면, ? BigInt::unsignedRightShift(leftNumber, rightNumber)를 반환한다.
    5. operation을 다음 table에서 opText와 associated된 abstract operation으로 둔다:
      opText operation
      * BigInt::multiply
      + BigInt::add
      - BigInt::subtract
      << BigInt::leftShift
      >> BigInt::signedRightShift
      & BigInt::bitwiseAND
      ^ BigInt::bitwiseXOR
      | BigInt::bitwiseOR
  7. 그렇지 않으면,
    1. Assert: leftNumber는 Number이다.
    2. operation을 다음 table에서 opText와 associated된 abstract operation으로 둔다:
      opText operation
      ** Number::exponentiate
      * Number::multiply
      / Number::divide
      % Number::remainder
      + Number::add
      - Number::subtract
      << Number::leftShift
      >> Number::signedRightShift
      >>> Number::unsignedRightShift
      & Number::bitwiseAND
      ^ Number::bitwiseXOR
      | Number::bitwiseOR
  8. operation(leftNumber, rightNumber)를 반환한다.
Note 1

step 1.a1.bToPrimitive call에는 hint가 provided되지 않습니다. Date를 제외한 모든 standard object는 hint의 absence를 number가 given된 것처럼 handle합니다; Date는 hint의 absence를 string이 given된 것처럼 handle합니다. Exotic object는 hint의 absence를 다른 manner로 handle할 수 있습니다.

Note 2

step 1.c는 logical-and operation 대신 logical-or operation을 사용한다는 점에서 IsLessThan algorithm의 step 3와 다릅니다.

13.15.4 EvaluateStringOrNumericBinaryExpression ( leftOperand, opText, rightOperand )

The abstract operation EvaluateStringOrNumericBinaryExpression takes arguments leftOperand (a Parse Node), opText (**, *, /, %, +, -, <<, >>, >>>, &, ^, or |), and rightOperand (a Parse Node) and returns either a normal completion containing either a String, a BigInt, or a Number, or an abrupt completion. It performs the following steps when called:

  1. leftRefleftOperandEvaluation으로 ? 둔다.
  2. leftValue를 ? GetValue(leftRef)로 둔다.
  3. rightRefrightOperandEvaluation으로 ? 둔다.
  4. rightValue를 ? GetValue(rightRef)로 둔다.
  5. ApplyStringOrNumericBinaryOperator(leftValue, opText, rightValue)를 반환한다.

13.15.5 Destructuring Assignment

Supplemental Syntax

특정 circumstance에서 production
AssignmentExpression : LeftHandSideExpression = AssignmentExpression
의 instance를 processing할 때, LeftHandSideExpression의 interpretation은 다음 grammar를 사용하여 refined됩니다:

AssignmentPattern[Yield, Await] : ObjectAssignmentPattern[?Yield, ?Await] ArrayAssignmentPattern[?Yield, ?Await] ObjectAssignmentPattern[Yield, Await] : { } { AssignmentRestProperty[?Yield, ?Await] } { AssignmentPropertyList[?Yield, ?Await] } { AssignmentPropertyList[?Yield, ?Await] , AssignmentRestProperty[?Yield, ?Await]opt } ArrayAssignmentPattern[Yield, Await] : [ Elisionopt AssignmentRestElement[?Yield, ?Await]opt ] [ AssignmentElementList[?Yield, ?Await] ] [ AssignmentElementList[?Yield, ?Await] , Elisionopt AssignmentRestElement[?Yield, ?Await]opt ] AssignmentRestProperty[Yield, Await] : ... DestructuringAssignmentTarget[?Yield, ?Await] AssignmentPropertyList[Yield, Await] : AssignmentProperty[?Yield, ?Await] AssignmentPropertyList[?Yield, ?Await] , AssignmentProperty[?Yield, ?Await] AssignmentElementList[Yield, Await] : AssignmentElisionElement[?Yield, ?Await] AssignmentElementList[?Yield, ?Await] , AssignmentElisionElement[?Yield, ?Await] AssignmentElisionElement[Yield, Await] : Elisionopt AssignmentElement[?Yield, ?Await] AssignmentProperty[Yield, Await] : IdentifierReference[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]opt PropertyName[?Yield, ?Await] : AssignmentElement[?Yield, ?Await] AssignmentElement[Yield, Await] : DestructuringAssignmentTarget[?Yield, ?Await] Initializer[+In, ?Yield, ?Await]opt AssignmentRestElement[Yield, Await] : ... DestructuringAssignmentTarget[?Yield, ?Await] DestructuringAssignmentTarget[Yield, Await] : LeftHandSideExpression[?Yield, ?Await]

13.15.5.1 Static Semantics: Early Errors

AssignmentProperty : IdentifierReference Initializeropt AssignmentRestProperty : ... DestructuringAssignmentTarget DestructuringAssignmentTarget : LeftHandSideExpression

13.15.5.2 Runtime Semantics: DestructuringAssignmentEvaluation

The syntax-directed operation DestructuringAssignmentEvaluation takes argument value (an ECMAScript language value) and returns either a normal completion containing unused or an abrupt completion. It is defined piecewise over the following productions:

ObjectAssignmentPattern : { }
  1. RequireObjectCoercible(value)를 수행한다.
  2. unused를 반환한다.
ObjectAssignmentPattern : { AssignmentPropertyList } { AssignmentPropertyList , }
  1. RequireObjectCoercible(value)를 수행한다.
  2. argument value를 가진 AssignmentPropertyListPropertyDestructuringAssignmentEvaluation을 ? 수행한다.
  3. unused를 반환한다.
ObjectAssignmentPattern : { AssignmentRestProperty }
  1. RequireObjectCoercible(value)를 수행한다.
  2. excludedNames를 새 empty List로 둔다.
  3. arguments valueexcludedNames를 가진 AssignmentRestPropertyRestDestructuringAssignmentEvaluation을 ? 반환한다.
ObjectAssignmentPattern : { AssignmentPropertyList , AssignmentRestProperty }
  1. RequireObjectCoercible(value)를 수행한다.
  2. excludedNames를 argument value를 가진 AssignmentPropertyListPropertyDestructuringAssignmentEvaluation으로 ? 둔다.
  3. arguments valueexcludedNames를 가진 AssignmentRestPropertyRestDestructuringAssignmentEvaluation을 ? 반환한다.
ArrayAssignmentPattern : [ ]
  1. iteratorRecord를 ? GetIterator(value, sync)로 둔다.
  2. IteratorClose(iteratorRecord, NormalCompletion(unused))를 반환한다.
ArrayAssignmentPattern : [ Elision ]
  1. iteratorRecord를 ? GetIterator(value, sync)로 둔다.
  2. result를 argument iteratorRecord를 가진 ElisionIteratorDestructuringAssignmentEvaluationCompletion으로 둔다.
  3. iteratorRecord.[[Done]]false이면, ? IteratorClose(iteratorRecord, result)를 반환한다.
  4. result를 반환한다.
ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
  1. iteratorRecord를 ? GetIterator(value, sync)로 둔다.
  2. Elision이 present이면, 다음을 수행한다.
    1. status를 argument iteratorRecord를 가진 ElisionIteratorDestructuringAssignmentEvaluationCompletion으로 둔다.
    2. statusabrupt completion이면, 다음을 수행한다.
      1. Assert: iteratorRecord.[[Done]]true이다.
      2. status를 반환한다.
  3. result를 argument iteratorRecord를 가진 AssignmentRestElementIteratorDestructuringAssignmentEvaluationCompletion으로 둔다.
  4. iteratorRecord.[[Done]]false이면, ? IteratorClose(iteratorRecord, result)를 반환한다.
  5. result를 반환한다.
ArrayAssignmentPattern : [ AssignmentElementList ]
  1. iteratorRecord를 ? GetIterator(value, sync)로 둔다.
  2. result를 argument iteratorRecord를 가진 AssignmentElementListIteratorDestructuringAssignmentEvaluationCompletion으로 둔다.
  3. iteratorRecord.[[Done]]false이면, ? IteratorClose(iteratorRecord, result)를 반환한다.
  4. result를 반환한다.
ArrayAssignmentPattern : [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
  1. iteratorRecord를 ? GetIterator(value, sync)로 둔다.
  2. status를 argument iteratorRecord를 가진 AssignmentElementListIteratorDestructuringAssignmentEvaluationCompletion으로 둔다.
  3. statusabrupt completion이면, 다음을 수행한다.
    1. iteratorRecord.[[Done]]false이면, ? IteratorClose(iteratorRecord, status)를 반환한다.
    2. status를 반환한다.
  4. Elision이 present이면, 다음을 수행한다.
    1. status를 argument iteratorRecord를 가진 ElisionIteratorDestructuringAssignmentEvaluationCompletion으로 설정한다.
    2. statusabrupt completion이면, 다음을 수행한다.
      1. Assert: iteratorRecord.[[Done]]true이다.
      2. status를 반환한다.
  5. AssignmentRestElement가 present이면, 다음을 수행한다.
    1. status를 argument iteratorRecord를 가진 AssignmentRestElementIteratorDestructuringAssignmentEvaluationCompletion으로 설정한다.
  6. iteratorRecord.[[Done]]false이면, ? IteratorClose(iteratorRecord, status)를 반환한다.
  7. status를 반환한다.

13.15.5.3 Runtime Semantics: PropertyDestructuringAssignmentEvaluation

The syntax-directed operation PropertyDestructuringAssignmentEvaluation takes argument value (an ECMAScript language value) and returns either a normal completion containing a List of property keys or an abrupt completion. destructured property key 전체의 list를 collect합니다. It is defined piecewise over the following productions:

AssignmentPropertyList : AssignmentPropertyList , AssignmentProperty
  1. propertyNames를 argument value를 가진 AssignmentPropertyListPropertyDestructuringAssignmentEvaluation으로 ? 둔다.
  2. nextNames를 argument value를 가진 AssignmentPropertyPropertyDestructuringAssignmentEvaluation으로 ? 둔다.
  3. propertyNamesnextNameslist-concatenation을 반환한다.
AssignmentProperty : IdentifierReference Initializeropt
  1. propertyNameIdentifierReferenceStringValue로 둔다.
  2. leftRef를 ? ResolveBinding(propertyName)으로 둔다.
  3. value를 ? GetV(value, propertyName)로 설정한다.
  4. Initializer가 present이고 valueundefined이면, 다음을 수행한다.
    1. IsAnonymousFunctionDefinition(Initializer)이 true이면, 다음을 수행한다.
      1. value를 argument propertyName을 가진 InitializerNamedEvaluation으로 ? 설정한다.
    2. 그렇지 않으면,
      1. defaultValueInitializerEvaluation으로 ? 둔다.
      2. value를 ? GetValue(defaultValue)로 설정한다.
  5. PutValue(leftRef, value)를 수행한다.
  6. « propertyName »를 반환한다.
AssignmentProperty : PropertyName : AssignmentElement
  1. namePropertyNameEvaluation으로 ? 둔다.
  2. arguments valuename을 가진 AssignmentElementKeyedDestructuringAssignmentEvaluation을 ? 수행한다.
  3. « name »를 반환한다.

13.15.5.4 Runtime Semantics: RestDestructuringAssignmentEvaluation

The syntax-directed operation RestDestructuringAssignmentEvaluation takes arguments value (an ECMAScript language value) and excludedNames (a List of property keys) and returns either a normal completion containing unused or an abrupt completion. It is defined piecewise over the following productions:

AssignmentRestProperty : ... DestructuringAssignmentTarget
  1. leftRefDestructuringAssignmentTargetEvaluation으로 ? 둔다.
  2. restObjOrdinaryObjectCreate(%Object.prototype%)로 둔다.
  3. CopyDataProperties(restObj, value, excludedNames)를 수행한다.
  4. PutValue(leftRef, restObj)를 반환한다.

13.15.5.5 Runtime Semantics: IteratorDestructuringAssignmentEvaluation

The syntax-directed operation IteratorDestructuringAssignmentEvaluation takes argument iteratorRecord (an Iterator Record) and returns either a normal completion containing unused or an abrupt completion. It is defined piecewise over the following productions:

AssignmentElementList : AssignmentElisionElement
  1. argument iteratorRecord를 가진 AssignmentElisionElementIteratorDestructuringAssignmentEvaluation을 ? 반환한다.
AssignmentElementList : AssignmentElementList , AssignmentElisionElement
  1. argument iteratorRecord를 가진 AssignmentElementListIteratorDestructuringAssignmentEvaluation을 ? 수행한다.
  2. argument iteratorRecord를 가진 AssignmentElisionElementIteratorDestructuringAssignmentEvaluation을 ? 반환한다.
AssignmentElisionElement : AssignmentElement
  1. argument iteratorRecord를 가진 AssignmentElementIteratorDestructuringAssignmentEvaluation을 ? 반환한다.
AssignmentElisionElement : Elision AssignmentElement
  1. argument iteratorRecord를 가진 ElisionIteratorDestructuringAssignmentEvaluation을 ? 수행한다.
  2. argument iteratorRecord를 가진 AssignmentElementIteratorDestructuringAssignmentEvaluation을 ? 반환한다.
Elision : ,
  1. iteratorRecord.[[Done]]false이면, 다음을 수행한다.
    1. IteratorStep(iteratorRecord)를 수행한다.
  2. unused를 반환한다.
Elision : Elision ,
  1. argument iteratorRecord를 가진 ElisionIteratorDestructuringAssignmentEvaluation을 ? 수행한다.
  2. iteratorRecord.[[Done]]false이면, 다음을 수행한다.
    1. IteratorStep(iteratorRecord)를 수행한다.
  3. unused를 반환한다.
AssignmentElement : DestructuringAssignmentTarget Initializeropt
  1. DestructuringAssignmentTargetObjectLiteralArrayLiteral도 아니면, 다음을 수행한다.
    1. leftRefDestructuringAssignmentTargetEvaluation으로 ? 둔다.
  2. valueundefined로 둔다.
  3. iteratorRecord.[[Done]]false이면, 다음을 수행한다.
    1. next를 ? IteratorStepValue(iteratorRecord)로 둔다.
    2. nextdone이 아니면, 다음을 수행한다.
      1. valuenext로 설정한다.
  4. Initializer가 present이고 valueundefined이면, 다음을 수행한다.
    1. IsAnonymousFunctionDefinition(Initializer)이 true이고 DestructuringAssignmentTargetIsIdentifierReftrue이면, 다음을 수행한다.
      1. targetDestructuringAssignmentTargetStringValue로 둔다.
      2. v를 argument target을 가진 InitializerNamedEvaluation으로 ? 둔다.
    2. 그렇지 않으면,
      1. defaultValueInitializerEvaluation으로 ? 둔다.
      2. v를 ? GetValue(defaultValue)로 둔다.
  5. 그렇지 않으면,
    1. vvalue로 둔다.
  6. DestructuringAssignmentTargetObjectLiteral 또는 ArrayLiteral 중 하나이면, 다음을 수행한다.
    1. nestedAssignmentPatternDestructuringAssignmentTargetcovered하는 AssignmentPattern으로 둔다.
    2. argument v를 가진 nestedAssignmentPatternDestructuringAssignmentEvaluation을 ? 반환한다.
  7. PutValue(leftRef, v)를 반환한다.
Note

destructuring pattern이 아닌 DestructuringAssignmentTargetiterator에 accessing하거나 Initializer를 evaluating하기 전에 evaluating함으로써 left-to-right evaluation order가 maintained됩니다.

AssignmentRestElement : ... DestructuringAssignmentTarget
  1. DestructuringAssignmentTargetObjectLiteralArrayLiteral도 아니면, 다음을 수행한다.
    1. leftRefDestructuringAssignmentTargetEvaluation으로 ? 둔다.
  2. array를 ! ArrayCreate(0)으로 둔다.
  3. n을 0으로 둔다.
  4. iteratorRecord.[[Done]]false인 동안 Repeat,
    1. next를 ? IteratorStepValue(iteratorRecord)로 둔다.
    2. nextdone이 아니면, 다음을 수행한다.
      1. CreateDataPropertyOrThrow(array, ! ToString(𝔽(n)), next)를 수행한다.
      2. nn + 1로 설정한다.
  5. DestructuringAssignmentTargetObjectLiteralArrayLiteral도 아니면, 다음을 수행한다.
    1. PutValue(leftRef, array)를 반환한다.
  6. nestedAssignmentPatternDestructuringAssignmentTargetcovered하는 AssignmentPattern으로 둔다.
  7. argument array를 가진 nestedAssignmentPatternDestructuringAssignmentEvaluation을 ? 반환한다.

13.15.5.6 Runtime Semantics: KeyedDestructuringAssignmentEvaluation

The syntax-directed operation KeyedDestructuringAssignmentEvaluation takes arguments value (an ECMAScript language value) and propertyName (a property key) and returns either a normal completion containing unused or an abrupt completion. It is defined piecewise over the following productions:

AssignmentElement : DestructuringAssignmentTarget Initializeropt
  1. DestructuringAssignmentTargetObjectLiteralArrayLiteral도 아니면, 다음을 수행한다.
    1. leftRefDestructuringAssignmentTargetEvaluation으로 ? 둔다.
  2. value를 ? GetV(value, propertyName)로 설정한다.
  3. Initializer가 present이고 valueundefined이면, 다음을 수행한다.
    1. IsAnonymousFunctionDefinition(Initializer)이 true이고 DestructuringAssignmentTargetIsIdentifierReftrue이면, 다음을 수행한다.
      1. targetDestructuringAssignmentTargetStringValue로 둔다.
      2. rhsValue를 argument target을 가진 InitializerNamedEvaluation으로 ? 둔다.
    2. 그렇지 않으면,
      1. defaultValueInitializerEvaluation으로 ? 둔다.
      2. rhsValue를 ? GetValue(defaultValue)로 둔다.
  4. 그렇지 않으면,
    1. rhsValuevalue로 둔다.
  5. DestructuringAssignmentTargetObjectLiteral 또는 ArrayLiteral 중 하나이면, 다음을 수행한다.
    1. assignmentPatternDestructuringAssignmentTargetcovered하는 AssignmentPattern으로 둔다.
    2. argument rhsValue를 가진 assignmentPatternDestructuringAssignmentEvaluation을 ? 반환한다.
  6. PutValue(leftRef, rhsValue)를 반환한다.

13.16 Comma Operator ( , )

Syntax

Expression[In, Yield, Await] : AssignmentExpression[?In, ?Yield, ?Await] Expression[?In, ?Yield, ?Await] , AssignmentExpression[?In, ?Yield, ?Await]

13.16.1 Runtime Semantics: Evaluation

Expression : Expression , AssignmentExpression
  1. leftRefExpressionEvaluation으로 ? 둔다.
  2. GetValue(leftRef)를 수행한다.
  3. rightRefAssignmentExpressionEvaluation으로 ? 둔다.
  4. GetValue(rightRef)를 반환한다.
Note

value가 사용되지 않더라도 observable side-effect가 있을 수 있으므로 GetValue가 called되어야 합니다.