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 는 문법상 BindingIdentifier 로 허용되며, 아래 정적 의미론에서 금지되어 다음과 같은 경우의 자동 세미콜론 삽입을 막는다:

let
await 0;

13.1.1 정적 의미론: 조기 오류(Early Errors)

BindingIdentifier : Identifier
  • IsStrict(this production) 가 true 이고 Identifier 의 StringValue 가 "arguments" 또는 "eval" 이면 Syntax Error.
IdentifierReference : yield BindingIdentifier : yield LabelIdentifier : yield
  • IsStrict(this production) 가 true 이면 Syntax Error.
IdentifierReference : await BindingIdentifier : await LabelIdentifier : await
  • 구문 문법의 목표 심볼이 Module 이면 Syntax Error.
BindingIdentifier[Yield, Await] : yield
  • 이 생성물이 [Yield] 매개변수를 가지면 Syntax Error.
BindingIdentifier[Yield, Await] : await
  • 이 생성물이 [Await] 매개변수를 가지면 Syntax Error.
IdentifierReference[Yield, Await] : Identifier BindingIdentifier[Yield, Await] : Identifier LabelIdentifier[Yield, Await] : Identifier
  • 이 생성물이 [Yield] 매개변수를 가지고 Identifier 의 StringValue 가 "yield" 이면 Syntax Error.
  • 이 생성물이 [Await] 매개변수를 가지고 Identifier 의 StringValue 가 "await" 이면 Syntax Error.
Identifier : IdentifierName but not ReservedWord
  • IsStrict(this phrase) 가 true 이고 IdentifierName 의 StringValue 가 "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield" 중 하나이면 Syntax Error.
  • 구문 문법의 목표 심볼이 Module 이고 IdentifierName 의 StringValue 가 "await" 이면 Syntax Error.
  • IdentifierName 의 StringValue 가 yield, await 를 제외한 어느 ReservedWord 의 StringValue 와 같으면 Syntax Error.
Note

IdentifierName 의 StringValue 는 IdentifierName 내 유니코드 escape 시퀀스를 정규화하므로, 그러한 escape 로 ReservedWord 와 동일한 코드 포인트 시퀀스를 가진 Identifier 를 작성할 수 없다.

13.1.2 정적 의미론: StringValue : String

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:

IdentifierName :: IdentifierStart IdentifierName IdentifierPart
  1. idTextUnescapedIdentifierName 의 IdentifierCodePoints 로 둔다.
  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. IdentifierName 의 StringValue 를 반환한다.
PrivateIdentifier :: # IdentifierName
  1. 0x0023 (NUMBER SIGN) 과 IdentifierName 의 StringValue 의 문자열 연결을 반환한다.
ModuleExportName : StringLiteral
  1. StringLiteral 의 SV 를 반환한다.

13.1.3 런타임 의미론: 평가(Evaluation)

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

IdentifierReference 평가 결과는 항상 Reference 타입 값이다.

Note 2

비 strict 코드에서 키워드 yield 는 식별자로 사용할 수 있다. IdentifierReference 평가 시 yield 바인딩을 Identifier 처럼 해석한다. 조기 오류 제한이 그러한 평가가 비 strict 코드에서만 일어날 수 있게 보장한다.

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)

다음 생성물 인스턴스를 처리할 때
PrimaryExpression[Yield, Await] : CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
CoverParenthesizedExpressionAndArrowParameterList 의 해석은 아래 문법을 사용해 정밀화된다:

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

13.2.1 this 키워드(The this Keyword)

13.2.1.1 런타임 의미론: 평가(Evaluation)

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

13.2.2 식별자 참조(Identifier Reference)

IdentifierReference13.1 를 참조.

13.2.3 리터럴(Literals)

Syntax

Literal : NullLiteral BooleanLiteral NumericLiteral StringLiteral

13.2.3.1 런타임 의미론: 평가(Evaluation)

Literal : NullLiteral
  1. null 을 반환한다.
Literal : BooleanLiteral
  1. BooleanLiteral 이 토큰 false 이면 false 반환.
  2. BooleanLiteral 이 토큰 true 이면 true 반환.
Literal : NumericLiteral
  1. 12.9.3 에 정의된 NumericLiteral 의 NumericValue 를 반환한다.
Literal : StringLiteral
  1. 12.9.4.2 에 정의된 StringLiteral 의 SV 를 반환한다.

13.2.4 배열 이니셜라이저(Array Initializer)

Note

ArrayLiteral 은 0 개 이상 표현식(각각 배열 요소를 나타냄) 리스트를 대괄호로 둘러 배열 초기화를 기술하는 표현식이다. 요소는 리터럴일 필요가 없으며 배열 이니셜라이저가 평가될 때마다 평가된다.

배열 요소는 목록의 시작·중간·끝에서 생략(elide)될 수 있다. 요소 목록에서 쉼표 앞에 AssignmentExpression 이 없을 때(즉, 시작의 쉼표나 또 다른 쉼표 뒤) 빠진 요소는 배열 length 에 기여하며 이후 요소의 인덱스를 증가시킨다. 생략된 요소는 정의되지 않는다. 배열 끝에서 생략된 요소는 length 에 기여하지 않는다.

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 런타임 의미론: ArrayAccumulation : 정상 완료 시 정수 또는 abrupt completion

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:

Elision : ,
  1. lennextIndex + 1 로 둔다.
  2. Set(array, "length", 𝔽(len), true) 수행.
  3. NOTE: len 이 232 - 1 을 초과하면 위 단계는 throw.
  4. len 을 반환한다.
Elision : Elision ,
  1. Elision 의 ArrayAccumulation 을 (array, (nextIndex + 1)) 인수로 호출한 결과를 ? 로 반환한다.
ElementList : Elisionopt AssignmentExpression
  1. Elision 이 존재하면
    1. nextIndexElision 의 ArrayAccumulation(array, nextIndex) 결과로 설정 (?).
  2. initResultAssignmentExpression 의 Evaluation 결과 (?) 로 둔다.
  3. initValue 를 ? GetValue(initResult) 로 둔다.
  4. CreateDataPropertyOrThrow(array, ! ToString(𝔽(nextIndex)), initValue) 수행.
  5. nextIndex + 1 반환.
ElementList : Elisionopt SpreadElement
  1. Elision 이 존재하면
    1. nextIndexElision 의 ArrayAccumulation(array, nextIndex) 결과로 설정 (?).
  2. SpreadElement 의 ArrayAccumulation(array, nextIndex) 결과를 ? 로 반환한다.
ElementList : ElementList , Elisionopt AssignmentExpression
  1. nextIndexElementList 의 ArrayAccumulation(array, nextIndex) 결과로 설정 (?).
  2. Elision 이 존재하면
    1. nextIndexElision 의 ArrayAccumulation(array, nextIndex) 결과로 설정 (?).
  3. initResultAssignmentExpression Evaluation 결과 (?) 로 둔다.
  4. initValue 를 ? GetValue(initResult) 로 둔다.
  5. CreateDataPropertyOrThrow(array, ! ToString(𝔽(nextIndex)), initValue) 수행.
  6. nextIndex + 1 반환.
ElementList : ElementList , Elisionopt SpreadElement
  1. nextIndexElementList 의 ArrayAccumulation(array, nextIndex) 결과로 설정 (?).
  2. Elision 이 존재하면
    1. nextIndexElision 의 ArrayAccumulation(array, nextIndex) 결과로 설정 (?).
  3. SpreadElement 의 ArrayAccumulation(array, nextIndex) 결과를 ? 로 반환.
SpreadElement : ... AssignmentExpression
  1. spreadRefAssignmentExpression Evaluation 결과 (?) 로 둔다.
  2. spreadObj 를 ? GetValue(spreadRef) 로 둔다.
  3. iteratorRecord 를 ? GetIterator(spreadObj, sync) 로 둔다.
  4. 반복,
    1. next 를 ? IteratorStepValue(iteratorRecord) 로 둔다.
    2. nextdone 이면 nextIndex 반환.
    3. CreateDataPropertyOrThrow(array, ! ToString(𝔽(nextIndex)), next) 수행.
    4. nextIndexnextIndex + 1 로 설정.
Note

CreateDataPropertyOrThrow 는 표준 내장 Array 프로토타입이 [[Set]] 으로 새로운 자체 프로퍼티 생성을 막도록 수정된 경우에도 자체 프로퍼티 정의를 보장하기 위해 사용된다.

13.2.4.2 런타임 의미론: 평가(Evaluation)

ArrayLiteral : [ Elisionopt ]
  1. array 를 ! ArrayCreate(0) 로 둔다.
  2. Elision 이 존재하면
    1. Elision 의 ArrayAccumulation(array, 0) 를 ? 로 수행.
  3. array 반환.
ArrayLiteral : [ ElementList ]
  1. array 를 ! ArrayCreate(0) 로 둔다.
  2. ElementList 의 ArrayAccumulation(array, 0) 를 ? 로 수행.
  3. array 반환.
ArrayLiteral : [ ElementList , Elisionopt ]
  1. array 를 ! ArrayCreate(0) 로 둔다.
  2. nextIndexElementList 의 ArrayAccumulation(array, 0) 결과 (?) 로 둔다.
  3. Elision 이 존재하면
    1. Elision 의 ArrayAccumulation(array, nextIndex) 를 ? 로 수행.
  4. array 반환.

13.2.5 객체 이니셜라이저(Object Initializer)

Note 1

객체 이니셜라이저는 리터럴과 유사한 형태로 객체 초기화를 기술하는 표현식이다. 중괄호로 둘러싸인 0 개 이상 (프로퍼티 키, 값) 쌍 목록이며 값은 리터럴일 필요가 없고 이니셜라이저 평가 시마다 평가된다.

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 에 정의되어 있다.

Note 3

특정 문맥에서 ObjectLiteral 은 더 제한된 2차 문법을 덮는 cover 문법으로 사용된다. CoverInitializedName 생성물은 이러한 2차 문법을 완전히 덮기 위해 필요하다. 그러나 이 생성물 사용은 실제 ObjectLiteral 이 기대되는 일반 문맥에서 조기 Syntax Error 를 발생시킨다.

13.2.5.1 정적 의미론: 조기 오류(Early Errors)

PropertyDefinition : MethodDefinition

실제 객체 이니셜라이저를 기술하는 것 외에도 ObjectLiteral 생성물은 ObjectAssignmentPattern 의 cover 문법으로 사용될 수 있으며 CoverParenthesizedExpressionAndArrowParameterList 의 일부로 인식될 수 있다. ObjectLiteralObjectAssignmentPattern 이 필요한 문맥에 나타나면 아래 Early Error 규칙은 적용되지 않는다. 또한 초기 CoverParenthesizedExpressionAndArrowParameterList 또는 CoverCallExpressionAndAsyncArrowHead 파싱 시에도 적용되지 않는다.

PropertyDefinition : CoverInitializedName
  • 이 생성물이 어떤 소스 텍스트를 매칭하면 Syntax Error.
Note 1

이 생성물은 ObjectLiteralObjectAssignmentPattern 의 cover 문법이 되도록 존재한다. 실제 객체 이니셜라이저에는 나타날 수 없다.

ObjectLiteral : { PropertyDefinitionList } { PropertyDefinitionList , } Note 2

PropertyNameList 가 반환한 ListComputedPropertyName 으로 정의된 프로퍼티 이름을 포함하지 않는다.

13.2.5.2 정적 의미론: IsComputedPropertyKey : Boolean

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:

PropertyName : LiteralPropertyName
  1. false 반환.
PropertyName : ComputedPropertyName
  1. true 반환.

13.2.5.3 정적 의미론: PropertyNameList : String 들의 List

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:

PropertyDefinitionList : PropertyDefinition
  1. propNamePropertyDefinition 의 PropName 으로 둔다.
  2. propNameempty 이면 새 빈 List 반환.
  3. « propName » 반환.
PropertyDefinitionList : PropertyDefinitionList , PropertyDefinition
  1. listPropertyDefinitionList 의 PropertyNameList 로 둔다.
  2. propNamePropertyDefinition 의 PropName 으로 둔다.
  3. propNameempty 이면 list 반환.
  4. list 와 « propName » 의 리스트 연결 반환.

13.2.5.4 런타임 의미론: 평가(Evaluation)

ObjectLiteral : { }
  1. OrdinaryObjectCreate(%Object.prototype%) 반환.
ObjectLiteral : { PropertyDefinitionList } { PropertyDefinitionList , }
  1. objOrdinaryObjectCreate(%Object.prototype%) 로 둔다.
  2. PropertyDefinitionList 의 PropertyDefinitionEvaluation(obj) 를 ? 로 수행.
  3. obj 반환.
LiteralPropertyName : IdentifierName
  1. IdentifierName 의 StringValue 반환.
LiteralPropertyName : StringLiteral
  1. StringLiteral 의 SV 반환.
LiteralPropertyName : NumericLiteral
  1. nbrNumericLiteral 의 NumericValue 로 둔다.
  2. ToString(nbr) 반환.
ComputedPropertyName : [ AssignmentExpression ]
  1. exprValueAssignmentExpression Evaluation 결과 (?) 로 둔다.
  2. propName 을 ? GetValue(exprValue) 로 둔다.
  3. ToPropertyKey(propName) 반환.

13.2.5.5 런타임 의미론: PropertyDefinitionEvaluation : unused 를 담는 정상 완료 또는 abrupt completion

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:

PropertyDefinitionList : PropertyDefinitionList , PropertyDefinition
  1. PropertyDefinitionList 의 PropertyDefinitionEvaluation(object) 를 ? 로 수행.
  2. PropertyDefinition 의 PropertyDefinitionEvaluation(object) 를 ? 로 수행.
  3. unused 반환.
PropertyDefinition : ... AssignmentExpression
  1. exprValueAssignmentExpression Evaluation 결과 (?) 로 둔다.
  2. fromValue 를 ? GetValue(exprValue) 로 둔다.
  3. excludedNames 를 새 빈 List 로 둔다.
  4. CopyDataProperties(object, fromValue, excludedNames) 수행.
  5. unused 반환.
PropertyDefinition : IdentifierReference
  1. propNameIdentifierReference 의 StringValue 로 둔다.
  2. exprValueIdentifierReference Evaluation 결과 (?) 로 둔다.
  3. propValue 를 ? GetValue(exprValue) 로 둔다.
  4. 단언: object 는 비구성 불가능한 프로퍼티가 없는 보통의(extensible) 객체.
  5. CreateDataPropertyOrThrow(object, propName, propValue) 수행.
  6. unused 반환.
PropertyDefinition : PropertyName : AssignmentExpression
  1. propKeyPropertyName Evaluation 결과 (?) 로 둔다.
  2. PropertyDefinitionParseJSON 평가 중인 Script 에 포함 (ParseJSON 단계 6) 이면
    1. isProtoSetterfalse 로 둔다.
  3. Else if propKey"__proto__" 이고 PropertyName 의 IsComputedPropertyKey 가 false 이면
    1. isProtoSettertrue 로 둔다.
  4. Else,
    1. isProtoSetterfalse 로 둔다.
  5. IsAnonymousFunctionDefinition(AssignmentExpression) 이 true 이고 isProtoSetterfalse 이면
    1. propValueAssignmentExpression 의 NamedEvaluation(propKey) 결과 (?) 로 둔다.
  6. Else,
    1. exprValueRefAssignmentExpression Evaluation 결과 (?) 로 둔다.
    2. propValue 를 ? GetValue(exprValueRef) 로 둔다.
  7. isProtoSettertrue 이면
    1. propValue 가 Object 이거나 null 이면
      1. object.[[SetPrototypeOf]](propValue) 수행.
    2. unused 반환.
  8. 단언: object 는 비구성 불가능한 프로퍼티가 없는 보통의 확장 가능한 객체.
  9. CreateDataPropertyOrThrow(object, propKey, propValue) 수행.
  10. unused 반환.
PropertyDefinition : MethodDefinition
  1. MethodDefinition 의 MethodDefinitionEvaluation(object, true) 를 ? 로 수행.
  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 정적 의미론: 조기 오류(Early Errors)

PrimaryExpression : RegularExpressionLiteral

13.2.7.2 정적 의미론: IsValidRegularExpressionLiteral ( literal: a RegularExpressionLiteral Parse Node, ): Boolean

The abstract operation UNKNOWN takes UNPARSEABLE ARGUMENTS. 인수가 유효한 정규 표현식 리터럴인지 판정한다. It performs the following steps when called:

  1. flagsliteral 의 FlagText 로 둔다.
  2. flagsd, g, i, m, s, u, v, y 이외 코드 포인트를 포함하거나 동일 코드 포인트를 중복 포함하면 false 반환.
  3. flagsu 포함하면 u = true, 아니면 false.
  4. flagsv 포함하면 v = true, 아니면 false.
  5. patternTextliteral 의 BodyText 로 둔다.
  6. ufalse 이고 vfalse 이면
    1. stringValue 를 CodePointsToString(patternText) 로 둔다.
    2. stringValue 의 16비트 요소 각각을 유니코드 BMP 코드 포인트로 해석한 코드 포인트 시퀀스로 patternText 재설정 (UTF-16 디코딩 미적용).
  7. parseResult 를 ParsePattern(patternText, u, v) 로 둔다.
  8. parseResult 가 Parse Node 이면 true 반환; 아니면 false 반환.

13.2.7.3 런타임 의미론: 평가(Evaluation)

PrimaryExpression : RegularExpressionLiteral
  1. pattern 을 CodePointsToString(BodyText of RegularExpressionLiteral) 로 둔다.
  2. flags 를 CodePointsToString(FlagText of RegularExpressionLiteral) 로 둔다.
  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 정적 의미론: 조기 오류(Early Errors)

TemplateLiteral[Yield, Await, Tagged] : NoSubstitutionTemplate TemplateLiteral[Yield, Await, Tagged] : SubstitutionTemplate[?Yield, ?Await, ?Tagged]
  • 인수 false 로 한 TemplateLiteral 의 TemplateStrings 요소 수가 232 이상이면 Syntax Error.
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 정적 의미론: TemplateStrings : String 또는 undefined 요소들의 List

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:

TemplateLiteral : NoSubstitutionTemplate
  1. « TemplateString(NoSubstitutionTemplate, raw) » 반환.
SubstitutionTemplate : TemplateHead Expression TemplateSpans
  1. head 를 « TemplateString(TemplateHead, raw) » 로 둔다.
  2. tailTemplateSpans 의 TemplateStrings(raw) 로 둔다.
  3. headtail 의 리스트 연결 반환.
TemplateSpans : TemplateTail
  1. « TemplateString(TemplateTail, raw) » 반환.
TemplateSpans : TemplateMiddleList TemplateTail
  1. middleTemplateMiddleList 의 TemplateStrings(raw) 로 둔다.
  2. tail 을 « TemplateString(TemplateTail, raw) » 로 둔다.
  3. 리스트 연결 반환.
TemplateMiddleList : TemplateMiddle Expression
  1. « TemplateString(TemplateMiddle, raw) » 반환.
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
  1. frontTemplateMiddleList 의 TemplateStrings(raw) 로 둔다.
  2. last 를 « TemplateString(TemplateMiddle, raw) » 로 둔다.
  3. frontlast 리스트 연결 반환.

13.2.8.3 정적 의미론: TemplateString ( templateToken: NoSubstitutionTemplate / TemplateHead / TemplateMiddle / TemplateTail Parse Node, raw: Boolean, ): String 또는 undefined

The abstract operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It performs the following steps when called:

  1. rawtrue 이면
    1. stringtemplateToken 의 TRV 로 둔다.
  2. Else
    1. stringtemplateToken 의 TV 로 둔다.
  3. string 반환.
Note

rawfalse 이고 templateTokenNotEscapeSequence 포함 시 undefined 반환. 그 외에는 String 반환.

13.2.8.4 GetTemplateObject ( templateLiteral )

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

  1. realm 을 현재 Realm Record 로 둔다.
  2. templateRegistryrealm.[[TemplateMap]] 로 둔다.
  3. templateRegistry 의 각 요소 e 에 대해
    1. e.[[Site]]templateLiteral 과 같은 Parse Node 이면
      1. e.[[Array]] 반환.
  4. rawStringstemplateLiteral 의 TemplateStrings(true) 로 둔다.
  5. 단언: rawStrings 는 String 들의 List.
  6. cookedStringstemplateLiteral 의 TemplateStrings(false) 로 둔다.
  7. countcookedStrings 요소 수로 둔다.
  8. 단언: count ≤ 232 - 1.
  9. template 를 ! ArrayCreate(count) 로 둔다.
  10. rawObj 를 ! ArrayCreate(count) 로 둔다.
  11. index 를 0 으로 둔다.
  12. index < count 동안 반복,
    1. prop 를 ! ToString(𝔽(index)) 로 둔다.
    2. cookedValuecookedStrings[index] 로 둔다.
    3. DefinePropertyOrThrow(template, prop, PropertyDescriptor { [[Value]]: cookedValue, [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: false }) 수행.
    4. rawValuerawStrings[index] 의 String 값으로 둔다.
    5. DefinePropertyOrThrow(rawObj, prop, 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]] 에 추가.
  17. template 반환.
Note 1

템플릿 객체 생성은 abrupt completion 을 일으킬 수 없다.

Note 2

realm 의 프로그램 코드 내 각 TemplateLiteral 은 태그드 템플릿 (13.2.8.6) 평가에 사용되는 고유한 템플릿 객체와 연관된다. 템플릿 객체는 freeze 되고 동일 템플릿이 평가될 때마다 같은 객체가 재사용된다. 지연 생성 또는 사전 생성 여부는 구현 선택이며 관측 불가.

Note 3

향후 판에서 템플릿 객체의 비열거(non-enumerable) 프로퍼티가 추가로 정의될 수 있다.

13.2.8.5 런타임 의미론: SubstitutionEvaluation : ECMAScript 값 List 를 담는 정상 완료 또는 abrupt completion

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:

TemplateSpans : TemplateTail
  1. 새 빈 List 반환.
TemplateSpans : TemplateMiddleList TemplateTail
  1. TemplateMiddleList 의 SubstitutionEvaluation 결과를 ? 로 반환.
TemplateMiddleList : TemplateMiddle Expression
  1. subRefExpression Evaluation 결과 (?) 로 둔다.
  2. sub 를 ? GetValue(subRef) 로 둔다.
  3. « sub » 반환.
TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
  1. precedingTemplateMiddleList 의 SubstitutionEvaluation 결과 (?) 로 둔다.
  2. nextRefExpression Evaluation 결과 (?) 로 둔다.
  3. next 를 ? GetValue(nextRef) 로 둔다.
  4. preceding 과 « next » 리스트 연결 반환.

13.2.8.6 런타임 의미론: 평가(Evaluation)

TemplateLiteral : NoSubstitutionTemplate
  1. 12.9.6 에 정의된 NoSubstitutionTemplate 의 TV 반환.
SubstitutionTemplate : TemplateHead Expression TemplateSpans
  1. head12.9.6 에 정의된 TemplateHead 의 TV 로 둔다.
  2. subRefExpression Evaluation 결과 (?) 로 둔다.
  3. sub 를 ? GetValue(subRef) 로 둔다.
  4. middle 를 ? ToString(sub) 로 둔다.
  5. tailTemplateSpans Evaluation 결과 (?) 로 둔다.
  6. head, middle, tail 의 문자열 연결 반환.
Note 1

Expression 값에 적용되는 문자열 변환 의미론은 + 연산자보다 String.prototype.concat 과 유사하다.

TemplateSpans : TemplateTail
  1. 12.9.6 에 정의된 TemplateTail 의 TV 반환.
TemplateSpans : TemplateMiddleList TemplateTail
  1. headTemplateMiddleList Evaluation 결과 (?) 로 둔다.
  2. tail12.9.6 에 정의된 TemplateTail 의 TV 로 둔다.
  3. headtail 문자열 연결 반환.
TemplateMiddleList : TemplateMiddle Expression
  1. head12.9.6 에 정의된 TemplateMiddle 의 TV 로 둔다.
  2. subRefExpression Evaluation 결과 (?) 로 둔다.
  3. sub 를 ? GetValue(subRef) 로 둔다.
  4. middle 를 ? ToString(sub) 로 둔다.
  5. headmiddle 문자열 연결 반환.
Note 2

Expression 값의 문자열 변환은 String.prototype.concat 과 유사.

TemplateMiddleList : TemplateMiddleList TemplateMiddle Expression
  1. restTemplateMiddleList Evaluation 결과 (?) 로 둔다.
  2. middle12.9.6 에 정의된 TemplateMiddle 의 TV 로 둔다.
  3. subRefExpression Evaluation 결과 (?) 로 둔다.
  4. sub 를 ? GetValue(subRef) 로 둔다.
  5. last 를 ? ToString(sub) 로 둔다.
  6. rest, middle, last 문자열 연결 반환.
Note 3

Expression 값의 문자열 변환은 String.prototype.concat 과 유사.

13.2.9 그룹 연산자(The Grouping Operator)

13.2.9.1 정적 의미론: 조기 오류(Early Errors)

PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList

13.2.9.2 런타임 의미론: 평가(Evaluation)

PrimaryExpression : CoverParenthesizedExpressionAndArrowParameterList
  1. exprCoverParenthesizedExpressionAndArrowParameterList 가 커버하는 ParenthesizedExpression 으로 둔다.
  2. expr 의 Evaluation 결과를 ? 로 반환.
ParenthesizedExpression : ( Expression )
  1. Expression 의 Evaluation 결과를 ? 로 반환. 이는 Reference 일 수 있다.
Note

이 알고리즘은 Expression 평가에 GetValue 를 적용하지 않는다. 이는 delete, typeof 같은 연산자가 괄호 친 표현식에 적용될 수 있도록 하는 주된 동기다.

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)

다음 생성물 인스턴스를 처리할 때
CallExpression : CoverCallExpressionAndAsyncArrowHead
CoverCallExpressionAndAsyncArrowHead 의 해석은 아래 문법을 사용해 정밀화된다:

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

13.3.1 정적 의미론(Static Semantics)

13.3.1.1 정적 의미론: 조기 오류(Early Errors)

OptionalChain : ?. TemplateLiteral OptionalChain TemplateLiteral
  • 이 생성물이 어떤 소스 텍스트와 매칭되면 Syntax Error이다.
Note

이 생성물은 아래 코드에 대해 자동 세미콜론 삽입 규칙(12.10)이 적용되어 두 개의 유효한 문장으로 해석되는 것을 방지하기 위해 존재한다:

a?.b
`c`

이는 선택적 체이닝이 없는 유사 코드와의 일관성을 유지하려는 목적이다:

a.b
`c`

위 코드는 유효한 문장이며 자동 세미콜론 삽입이 적용되지 않는다.

ImportMeta : import . meta
  • 구문 목표 심볼이 Module 이 아니면 Syntax Error이다.

13.3.2 프로퍼티 접근자(Property Accessors)

Note

프로퍼티는 이름으로 접근하며, 점 표기법(dot notation)을 사용할 수 있다:

또는 대괄호 표기법(bracket notation)을 사용할 수 있다:

점 표기법은 다음 구문 변환으로 설명된다:

는 동작상 다음과 동일하다:

MemberExpression [ <identifier-name-string> ]

비슷하게

도 동작상 다음과 동일하다:

CallExpression [ <identifier-name-string> ]

여기서 <identifier-name-string> 는 IdentifierName 의 StringValue 이다.

13.3.2.1 런타임 의미론: 평가(Evaluation)

MemberExpression : MemberExpression [ Expression ]
  1. baseReferenceMemberExpression 의 Evaluation 결과 (?) 로 둔다.
  2. baseValue 를 ? GetValue(baseReference) 로 둔다.
  3. strict 를 IsStrict(this MemberExpression) 로 둔다.
  4. EvaluatePropertyAccessWithExpressionKey(baseValue, Expression, strict) 를 반환한다.
MemberExpression : MemberExpression . IdentifierName
  1. baseReferenceMemberExpression 의 Evaluation 결과 (?) 로 둔다.
  2. baseValue 를 ? GetValue(baseReference) 로 둔다.
  3. strict 를 IsStrict(this MemberExpression) 로 둔다.
  4. EvaluatePropertyAccessWithIdentifierKey(baseValue, IdentifierName, strict) 를 반환한다.
MemberExpression : MemberExpression . PrivateIdentifier
  1. baseReferenceMemberExpression 의 Evaluation 결과 (?) 로 둔다.
  2. baseValue 를 ? GetValue(baseReference) 로 둔다.
  3. fieldNameStringPrivateIdentifier 의 StringValue 로 둔다.
  4. MakePrivateReference(baseValue, fieldNameString) 를 반환한다.
CallExpression : CallExpression [ Expression ]
  1. baseReferenceCallExpression 의 Evaluation 결과 (?) 로 둔다.
  2. baseValue 를 ? GetValue(baseReference) 로 둔다.
  3. strict 를 IsStrict(this CallExpression) 로 둔다.
  4. EvaluatePropertyAccessWithExpressionKey(baseValue, Expression, strict) 를 반환한다.
CallExpression : CallExpression . IdentifierName
  1. baseReferenceCallExpression 의 Evaluation 결과 (?) 로 둔다.
  2. baseValue 를 ? GetValue(baseReference) 로 둔다.
  3. strict 를 IsStrict(this CallExpression) 로 둔다.
  4. EvaluatePropertyAccessWithIdentifierKey(baseValue, IdentifierName, strict) 를 반환한다.
CallExpression : CallExpression . PrivateIdentifier
  1. baseReferenceCallExpression 의 Evaluation 결과 (?) 로 둔다.
  2. baseValue 를 ? GetValue(baseReference) 로 둔다.
  3. fieldNameStringPrivateIdentifier 의 StringValue 로 둔다.
  4. MakePrivateReference(baseValue, fieldNameString) 를 반환한다.

13.3.3 EvaluatePropertyAccessWithExpressionKey ( baseValue, expression, strict )

The abstract operation EvaluatePropertyAccessWithExpressionKey takes arguments baseValue (an ECMAScript language value), expression (an Expression Parse Node), and strict (a Boolean) and returns 정상 완료 시 Reference Record 또는 abrupt completion. It performs the following steps when called:

  1. propertyNameReferenceexpression 의 Evaluation 결과 (?) 로 둔다.
  2. propertyNameValue 를 ? GetValue(propertyNameReference) 로 둔다.
  3. NOTE: 대부분 경우 이 단계 직후 propertyNameValue 에 대해 ToPropertyKey 가 수행된다. 그러나 a[b] = c 의 경우 c 평가 이후에 수행된다.
  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 Reference Record. It performs the following steps when called:

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

13.3.5 new 연산자(The new Operator)

13.3.5.1 런타임 의미론: 평가(Evaluation)

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

13.3.5.1.1 EvaluateNew ( constructExpr, arguments )

The abstract operation EvaluateNew takes arguments constructExpr (a NewExpression Parse Node or a MemberExpression Parse Node) and arguments (empty or an Arguments Parse Node) and returns 정상 완료 시 ECMAScript 언어 값 또는 abrupt completion. It performs the following steps when called:

  1. refconstructExpr 의 Evaluation 결과 (?) 로 둔다.
  2. constructor 를 ? GetValue(ref) 로 둔다.
  3. argumentsempty 이면
    1. argList 를 새 빈 List 로 둔다.
  4. Else,
    1. argList 를 ? ArgumentListEvaluation(arguments) 로 둔다.
  5. IsConstructor(constructor) 가 false 이면 TypeError 예외를 throw.
  6. Construct(constructor, argList) 를 반환한다.

13.3.6 함수 호출(Function Calls)

13.3.6.1 런타임 의미론: 평가(Evaluation)

CallExpression : CoverCallExpressionAndAsyncArrowHead
  1. exprCoverCallExpressionAndAsyncArrowHead 가 커버하는 CallMemberExpression 으로 둔다.
  2. memberExprexprMemberExpression 으로 둔다.
  3. argumentsexprArguments 로 둔다.
  4. ref 를 ? Evaluation(memberExpr) 로 둔다.
  5. func 을 ? GetValue(ref) 로 둔다.
  6. refReference Record 이고 IsPropertyReference(ref) 가 false 이며 ref.[[ReferencedName]]"eval" 이면
    1. SameValue(func, %eval%) 이 true 이면
      1. argList 를 ? ArgumentListEvaluation(arguments) 로 둔다.
      2. argList 에 요소가 없으면 undefined 반환.
      3. evalArgargList 의 첫 요소로 둔다.
      4. IsStrict(this CallExpression) 이 true 이면 strictCaller = true, 아니면 false.
      5. PerformEval(evalArg, strictCaller, true) 를 반환한다.
  7. thisCall 을 this CallExpression 으로 둔다.
  8. tailCall 을 IsInTailPosition(thisCall) 로 둔다.
  9. EvaluateCall(func, ref, arguments, tailCall) 를 반환한다.

단계 6.a.v 를 수행한 CallExpression 평가는 직접 eval(direct eval) 이다.

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

13.3.6.2 EvaluateCall ( func, ref, arguments, tailPosition )

The abstract operation EvaluateCall takes arguments func (an ECMAScript language value), ref (an ECMAScript language value or a Reference Record), arguments (a Parse Node), and tailPosition (a Boolean) and returns 정상 완료 시 ECMAScript 언어 값 또는 abrupt completion. It performs the following steps when called:

  1. refReference Record 이면
    1. IsPropertyReference(ref) 가 true 이면
      1. thisValueGetThisValue(ref) 로 둔다.
    2. Else,
      1. refEnvref.[[Base]] 로 둔다.
      2. 단언: refEnvEnvironment Record.
      3. thisValuerefEnv.WithBaseObject() 로 둔다.
  2. Else,
    1. thisValueundefined 로 둔다.
  3. argList 를 ? ArgumentListEvaluation(arguments) 로 둔다.
  4. func 가 Object 가 아니면 TypeError 예외 throw.
  5. IsCallable(func) 이 false 이면 TypeError 예외 throw.
  6. tailPositiontrue 이면 PrepareForTailCall() 수행.
  7. Call(func, thisValue, argList) 를 반환한다.

13.3.7 super 키워드(The super Keyword)

13.3.7.1 런타임 의미론: 평가(Evaluation)

SuperProperty : super [ Expression ]
  1. envGetThisEnvironment() 로 둔다.
  2. actualThis 를 ? env.GetThisBinding() 로 둔다.
  3. propertyNameReference 를 ? Evaluation(Expression) 로 둔다.
  4. propertyNameValue 를 ? GetValue(propertyNameReference) 로 둔다.
  5. strict 를 IsStrict(this SuperProperty) 로 둔다.
  6. NOTE: 대부분 경우 이 단계 직후 propertyNameValue 에 대해 ToPropertyKey 가 수행된다. 하지만 super[b] = c 의 경우 c 평가 이후 수행된다.
  7. MakeSuperPropertyReference(actualThis, propertyNameValue, strict) 를 반환한다.
SuperProperty : super . IdentifierName
  1. envGetThisEnvironment() 로 둔다.
  2. actualThis 를 ? env.GetThisBinding() 로 둔다.
  3. propertyKeyIdentifierName 의 StringValue 로 둔다.
  4. strict 를 IsStrict(this SuperProperty) 로 둔다.
  5. MakeSuperPropertyReference(actualThis, propertyKey, strict) 를 반환한다.
SuperCall : super Arguments
  1. newTargetGetNewTarget() 로 둔다.
  2. 단언: newTarget 은 constructor.
  3. funcGetSuperConstructor() 로 둔다.
  4. argList 를 ? ArgumentListEvaluation(Arguments) 로 둔다.
  5. IsConstructor(func) 이 false 이면 TypeError 예외 throw.
  6. result 를 ? Construct(func, argList, newTarget) 로 둔다.
  7. thisERGetThisEnvironment() 로 둔다.
  8. 단언: thisERFunction Environment Record.
  9. BindThisValue(thisER, result) 수행.
  10. FthisER.[[FunctionObject]] 로 둔다.
  11. 단언: F 는 ECMAScript 함수 객체.
  12. InitializeInstanceElements(result, F) 수행.
  13. result 반환.

13.3.7.2 GetSuperConstructor ( )

The abstract operation GetSuperConstructor takes no arguments and returns ECMAScript 언어 값. It performs the following steps when called:

  1. envRecGetThisEnvironment() 로 둔다.
  2. 단언: envRecFunction Environment Record.
  3. activeFunctionenvRec.[[FunctionObject]] 로 둔다.
  4. 단언: activeFunction 은 ECMAScript 함수 객체.
  5. superConstructor 를 ! activeFunction.[[GetPrototypeOf]]() 로 둔다.
  6. superConstructor 반환.

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 Super Reference Record. It performs the following steps when called:

  1. envGetThisEnvironment() 로 둔다.
  2. 단언: env.HasSuperBinding() 은 true.
  3. 단언: envFunction Environment Record.
  4. baseValueGetSuperBase(env) 로 둔다.
  5. Reference Record { [[Base]]: baseValue, [[ReferencedName]]: propertyKey, [[Strict]]: strict, [[ThisValue]]: actualThis } 반환.

13.3.8 인자 목록(Argument Lists)

Note

인자 목록의 평가 결과는 값들의 List 를 생성한다.

13.3.8.1 런타임 의미론: ArgumentListEvaluation : 정상 완료 시 ECMAScript 언어 값들의 List 또는 abrupt completion

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:

Arguments : ( )
  1. 새 빈 List 반환.
ArgumentList : AssignmentExpression
  1. refAssignmentExpression Evaluation 결과 (?) 로 둔다.
  2. arg 를 ? GetValue(ref) 로 둔다.
  3. « arg » 반환.
ArgumentList : ... AssignmentExpression
  1. list 를 새 빈 List 로 둔다.
  2. spreadRefAssignmentExpression Evaluation 결과 (?) 로 둔다.
  3. spreadObj 를 ? GetValue(spreadRef) 로 둔다.
  4. iteratorRecord 를 ? GetIterator(spreadObj, sync) 로 둔다.
  5. 반복,
    1. next 를 ? IteratorStepValue(iteratorRecord) 로 둔다.
    2. nextdone 이면 list 반환.
    3. listnext 추가.
ArgumentList : ArgumentList , AssignmentExpression
  1. precedingArgs 를 ? ArgumentListEvaluation(ArgumentList) 로 둔다.
  2. refAssignmentExpression Evaluation 결과 (?) 로 둔다.
  3. arg 를 ? GetValue(ref) 로 둔다.
  4. precedingArgs 와 « arg » 의 리스트 연결 반환.
ArgumentList : ArgumentList , ... AssignmentExpression
  1. precedingArgs 를 ? ArgumentListEvaluation(ArgumentList) 로 둔다.
  2. spreadRefAssignmentExpression Evaluation 결과 (?) 로 둔다.
  3. iteratorRecord 를 ? GetIterator(? GetValue(spreadRef), sync) 로 둔다.
  4. 반복,
    1. next 를 ? IteratorStepValue(iteratorRecord) 로 둔다.
    2. nextdone 이면 precedingArgs 반환.
    3. precedingArgsnext 추가.
TemplateLiteral : NoSubstitutionTemplate
  1. templateLiteral 을 this TemplateLiteral 로 둔다.
  2. siteObjGetTemplateObject(templateLiteral) 로 둔다.
  3. « siteObj » 반환.
TemplateLiteral : SubstitutionTemplate
  1. templateLiteral 을 this TemplateLiteral 로 둔다.
  2. siteObjGetTemplateObject(templateLiteral) 로 둔다.
  3. remaining 을 ? ArgumentListEvaluation(SubstitutionTemplate) 로 둔다.
  4. « siteObj » 와 remaining 의 리스트 연결 반환.
SubstitutionTemplate : TemplateHead Expression TemplateSpans
  1. firstSubRef 를 ? Evaluation(Expression) 로 둔다.
  2. firstSub 를 ? GetValue(firstSubRef) 로 둔다.
  3. restSub 를 ? SubstitutionEvaluation(TemplateSpans) 로 둔다.
  4. 단언: restSub 는 (비어있을 수도 있는) List.
  5. « firstSub » 와 restSub 의 리스트 연결 반환.

13.3.9 옵셔널 체인(Optional Chains)

Note
옵셔널 체인은 하나 이상의 프로퍼티 접근과 함수 호출이 연속된 것으로, 첫 부분이 ?. 토큰으로 시작한다.

13.3.9.1 런타임 의미론: 평가(Evaluation)

OptionalExpression : MemberExpression OptionalChain
  1. baseReference 를 ? Evaluation(MemberExpression) 로 둔다.
  2. baseValue 를 ? GetValue(baseReference) 로 둔다.
  3. baseValueundefined 또는 null 이면
    1. undefined 반환.
  4. ? ChainEvaluation(OptionalChain, 인수 baseValue, baseReference) 를 반환.
OptionalExpression : CallExpression OptionalChain
  1. baseReference 를 ? Evaluation(CallExpression) 로 둔다.
  2. baseValue 를 ? GetValue(baseReference) 로 둔다.
  3. baseValueundefined 또는 null 이면
    1. undefined 반환.
  4. ? ChainEvaluation(OptionalChain, 인수 baseValue, baseReference) 반환.
OptionalExpression : OptionalExpression OptionalChain
  1. baseReference 를 ? Evaluation(OptionalExpression) 로 둔다.
  2. baseValue 를 ? GetValue(baseReference) 로 둔다.
  3. baseValueundefined 또는 null 이면
    1. undefined 반환.
  4. ? ChainEvaluation(OptionalChain, 인수 baseValue, baseReference) 반환.

13.3.9.2 런타임 의미론: ChainEvaluation : 정상 완료 시 ECMAScript 언어 값 또는 Reference Record, 또는 abrupt completion

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:

OptionalChain : ?. Arguments
  1. thisChain 을 this OptionalChain 으로 둔다.
  2. tailCall 을 IsInTailPosition(thisChain) 로 둔다.
  3. EvaluateCall(baseValue, baseReference, Arguments, tailCall) 반환.
OptionalChain : ?. [ Expression ]
  1. strict 를 IsStrict(this OptionalChain) 로 둔다.
  2. EvaluatePropertyAccessWithExpressionKey(baseValue, Expression, strict) 반환.
OptionalChain : ?. IdentifierName
  1. strict 를 IsStrict(this OptionalChain) 로 둔다.
  2. EvaluatePropertyAccessWithIdentifierKey(baseValue, IdentifierName, strict) 반환.
OptionalChain : ?. PrivateIdentifier
  1. fieldNameStringPrivateIdentifier 의 StringValue 로 둔다.
  2. MakePrivateReference(baseValue, fieldNameString) 반환.
OptionalChain : OptionalChain Arguments
  1. optionalChainOptionalChain 으로 둔다.
  2. newReference 를 ? ChainEvaluation(optionalChain, 인수 baseValue, baseReference) 로 둔다.
  3. newValue 를 ? GetValue(newReference) 로 둔다.
  4. thisChain 을 this OptionalChain 으로 둔다.
  5. tailCall 을 IsInTailPosition(thisChain) 로 둔다.
  6. EvaluateCall(newValue, newReference, Arguments, tailCall) 반환.
OptionalChain : OptionalChain [ Expression ]
  1. optionalChainOptionalChain 으로 둔다.
  2. newReference 를 ? ChainEvaluation(optionalChain, 인수 baseValue, baseReference) 로 둔다.
  3. newValue 를 ? GetValue(newReference) 로 둔다.
  4. strict 를 IsStrict(this OptionalChain) 로 둔다.
  5. EvaluatePropertyAccessWithExpressionKey(newValue, Expression, strict) 반환.
OptionalChain : OptionalChain . IdentifierName
  1. optionalChainOptionalChain 으로 둔다.
  2. newReference 를 ? ChainEvaluation(optionalChain, 인수 baseValue, baseReference) 로 둔다.
  3. newValue 를 ? GetValue(newReference) 로 둔다.
  4. strict 를 IsStrict(this OptionalChain) 로 둔다.
  5. EvaluatePropertyAccessWithIdentifierKey(newValue, IdentifierName, strict) 반환.
OptionalChain : OptionalChain . PrivateIdentifier
  1. optionalChainOptionalChain 으로 둔다.
  2. newReference 를 ? ChainEvaluation(optionalChain, 인수 baseValue, baseReference) 로 둔다.
  3. newValue 를 ? GetValue(newReference) 로 둔다.
  4. fieldNameStringPrivateIdentifier 의 StringValue 로 둔다.
  5. MakePrivateReference(newValue, fieldNameString) 반환.

13.3.10 import 호출(Import Calls)

13.3.10.1 런타임 의미론: 평가(Evaluation)

ImportCall : import ( AssignmentExpression ,opt )
  1. EvaluateImportCall(AssignmentExpression) 반환.
ImportCall : import ( AssignmentExpression , AssignmentExpression ,opt )
  1. EvaluateImportCall(첫 번째 AssignmentExpression, 두 번째 AssignmentExpression) 반환.

13.3.10.2 EvaluateImportCall ( specifierExpression [ , optionsExpression ] )

The abstract operation EvaluateImportCall takes argument specifierExpression (a Parse Node) and optional argument optionsExpression (a Parse Node) and returns 정상 완료 시 Promise 또는 abrupt completion. It performs the following steps when called:

  1. referrerGetActiveScriptOrModule() 로 둔다.
  2. referrernull 이면 현재 Realm Record 로 설정.
  3. specifierRef 를 ? Evaluation(specifierExpression) 로 둔다.
  4. specifier 를 ? GetValue(specifierRef) 로 둔다.
  5. optionsExpression 이 존재하면
    1. optionsRef 를 ? Evaluation(optionsExpression) 로 둔다.
    2. options 를 ? GetValue(optionsRef) 로 둔다.
  6. Else,
    1. options = undefined.
  7. promiseCapability 를 ! NewPromiseCapability(%Promise%) 로 둔다.
  8. specifierStringCompletion(ToString(specifier)) 로 둔다.
  9. IfAbruptRejectPromise(specifierString, promiseCapability).
  10. attributes 를 새 빈 List 로 둔다.
  11. optionsundefined 가 아니면
    1. options 가 Object 가 아니면
      1. Call(promiseCapability.[[Reject]], undefined, « 새로 생성된 TypeError 객체 ») 수행.
      2. promiseCapability.[[Promise]] 반환.
    2. attributesObjCompletion(Get(options, "with")).
    3. IfAbruptRejectPromise(attributesObj, promiseCapability).
    4. attributesObjundefined 가 아니면
      1. attributesObj 가 Object 가 아니면
        1. Call(promiseCapability.[[Reject]], undefined, « 새로 생성된 TypeError 객체 ») 수행.
        2. promiseCapability.[[Promise]] 반환.
      2. entriesCompletion(EnumerableOwnProperties(attributesObj, key+value)).
      3. IfAbruptRejectPromise(entries, promiseCapability).
      4. entries 의 각 entry 에 대해
        1. key = ! Get(entry, "0").
        2. value = ! Get(entry, "1").
        3. key 가 String 이면
          1. value 가 String 이 아니면
            1. Call(promiseCapability.[[Reject]], undefined, « 새로 생성된 TypeError 객체 ») 수행.
            2. promiseCapability.[[Promise]] 반환.
          2. ImportAttribute Record { [[Key]]: key, [[Value]]: value } 를 attributes 에 추가.
    5. AllImportAttributesSupported(attributes) 가 false 이면
      1. Call(promiseCapability.[[Reject]], undefined, « 새로 생성된 TypeError 객체 ») 수행.
      2. promiseCapability.[[Promise]] 반환.
    6. attributes 를 각 [[Key]] 필드의 UTF-16 코드 유닛 시퀀스 사전식 순서로 정렬. (NOTE: 정렬은 호스트가 열거 순서를 기반으로 동작을 바꾸는 것을 금지하는 방식으로만 관찰 가능)
  12. moduleRequest 를 새 ModuleRequest Record { [[Specifier]]: specifierString, [[Attributes]]: attributes } 로 둔다.
  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 (Module Record 를 담는 정상 completion 또는 throw completion) and returns unused. import() 호출로 시작된 동적 import 과정을 마무리하여, 해당 호출이 반환한 promise 를 적절히 이행(resolve) 또는 거부(reject)한다. It performs the following steps when called:

  1. moduleCompletionabrupt completion 이면
    1. Call(promiseCapability.[[Reject]], undefined, « moduleCompletion.[[Value]] ») 수행.
    2. unused 반환.
  2. modulemoduleCompletion.[[Value]] 로 둔다.
    1. loadPromisemodule.LoadRequestedModules() 로 둔다.
  3. rejectedClosure 를 (reason) 매개변수를 가지며 promiseCapability 를 캡처하고 호출 시:
    1. Call(promiseCapability.[[Reject]], undefined, « reason ») 수행.
    2. NormalCompletion(undefined) 반환.
  4. onRejectedCreateBuiltinFunction(rejectedClosure, 1, "", « ») 로 둔다.
  5. linkAndEvaluateClosure 를 매개변수 없고 module, promiseCapability, onRejected 를 캡처하며 호출 시:
    1. link = Completion(module.Link()).
    2. linkabrupt completion 이면
      1. Call(promiseCapability.[[Reject]], undefined, « link.[[Value]] ») 수행.
      2. NormalCompletion(undefined) 반환.
    3. evaluatePromisemodule.Evaluate() 로 둔다.
    4. fulfilledClosure 를 매개변수 없고 module, promiseCapability 캡처하며 호출 시:
      1. namespace = GetModuleNamespace(module).
      2. Call(promiseCapability.[[Resolve]], undefined, « namespace ») 수행.
      3. NormalCompletion(undefined) 반환.
    5. onFulfilled = CreateBuiltinFunction(fulfilledClosure, 0, "", « »).
    6. PerformPromiseThen(evaluatePromise, onFulfilled, onRejected) 수행.
    7. unused 반환.
  6. linkAndEvaluate = CreateBuiltinFunction(linkAndEvaluateClosure, 0, "", « »).
  7. PerformPromiseThen(loadPromise, linkAndEvaluate, onRejected) 수행.
  8. unused 반환.

13.3.11 태그드 템플릿(Tagged Templates)

Note

태그드 템플릿은 호출 인자가 TemplateLiteral (13.2.8) 로부터 파생되는 함수 호출이다. 실제 인자에는 템플릿 객체(13.2.8.4)와 TemplateLiteral 안에 포함된 표현식들을 평가하여 얻은 값들이 포함된다.

13.3.11.1 런타임 의미론: 평가(Evaluation)

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

13.3.12 메타 프로퍼티(Meta Properties)

13.3.12.1 런타임 의미론: 평가(Evaluation)

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

13.3.12.1.1 HostGetImportMetaProperties ( moduleRecord )

The host-defined abstract operation HostGetImportMetaProperties takes argument moduleRecord (a Module Record) and returns [[Key]] (property key), [[Value]] (ECMAScript 언어 값) 필드를 가진 Record 들의 List. 호스트import.meta 로부터 반환되는 객체에 대한 프로퍼티 키와 값을 제공할 수 있게 한다.

HostGetImportMetaProperties 의 기본 구현은 새 빈 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. 호스트import.meta 로부터 반환되는 객체를 ECMAScript 코드에 노출하기 전에 추가 작업을 수행할 수 있게 한다.

대부분 호스트HostGetImportMetaProperties 를 정의하고 HostFinalizeImportMeta 는 기본 동작을 그대로 둘 수 있다. 그러나 HostFinalizeImportMeta 는 노출 전에 객체를 직접 조작해야 하는 호스트를 위한 “escape hatch” 를 제공한다.

HostFinalizeImportMeta 의 기본 구현은 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
  • UnaryExpression 의 AssignmentTargetType 이 invalid 이면 초기(early) Syntax Error 이다.

13.4.2 후위 증가 연산자(Postfix Increment Operator)

13.4.2.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

UpdateExpression : LeftHandSideExpression ++
  1. lhsLeftHandSideExpression 의 Evaluation 결과 (?) 로 둔다.
  2. LeftHandSideExpression 의 AssignmentTargetType 이 web-compat 이면 ReferenceError 예외를 throw 한다.
  3. oldValue 를 ? ToNumeric(? GetValue(lhs)) 로 둔다.
  4. oldValue 가 Number 이면
    1. newValueNumber::add(oldValue, 1𝔽) 로 둔다.
  5. 그렇지 않으면
    1. 단언: 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. lhsLeftHandSideExpression 의 Evaluation 결과 (?) 로 둔다.
  2. LeftHandSideExpression 의 AssignmentTargetType 이 web-compat 이면 ReferenceError 예외를 throw 한다.
  3. oldValue 를 ? ToNumeric(? GetValue(lhs)) 로 둔다.
  4. oldValue 가 Number 이면
    1. newValueNumber::subtract(oldValue, 1𝔽) 로 둔다.
  5. 그렇지 않으면
    1. 단언: 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. exprUnaryExpression 의 Evaluation 결과 (?) 로 둔다.
  2. UnaryExpression 의 AssignmentTargetType 이 web-compat 이면 ReferenceError 예외를 throw 한다.
  3. oldValue 를 ? ToNumeric(? GetValue(expr)) 로 둔다.
  4. oldValue 가 Number 이면
    1. newValueNumber::add(oldValue, 1𝔽) 로 둔다.
  5. 그렇지 않으면
    1. 단언: 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. exprUnaryExpression 의 Evaluation 결과 (?) 로 둔다.
  2. UnaryExpression 의 AssignmentTargetType 이 web-compat 이면 ReferenceError 예외를 throw 한다.
  3. oldValue 를 ? ToNumeric(? GetValue(expr)) 로 둔다.
  4. oldValue 가 Number 이면
    1. newValueNumber::subtract(oldValue, 1𝔽) 로 둔다.
  5. 그렇지 않으면
    1. 단언: 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] AwaitExpression[?Yield]

13.5.1 delete 연산자(The delete Operator)

13.5.1.1 정적 의미론: 조기 오류(Static Semantics: Early Errors)

UnaryExpression : delete UnaryExpression Note

마지막 규칙은 delete (((foo))) 같은 표현식이 첫 번째 규칙의 재귀 적용으로 인해 조기 오류를 발생함을 의미한다.

13.5.1.2 런타임 의미론: 평가(Runtime Semantics: Evaluation)

UnaryExpression : delete UnaryExpression
  1. refUnaryExpression 의 Evaluation 결과 (?) 로 둔다.
  2. refReference Record 가 아니면 true 반환.
  3. IsUnresolvableReference(ref) 가 true 이면
    1. 단언: ref.[[Strict]]false.
    2. true 반환.
  4. IsPropertyReference(ref) 가 true 이면
    1. 단언: IsPrivateReference(ref) 는 false.
    2. IsSuperReference(ref) 가 true 이면 ReferenceError 예외 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 예외 throw.
    7. deleteStatus 반환.
  5. 그렇지 않으면
    1. baseref.[[Base]] 로 둔다.
    2. 단언: baseEnvironment Record.
    3. base.DeleteBinding(ref.[[ReferencedName]]) 반환.
Note 1

delete 연산자가 strict 모드 코드 안에 나타나고 그 UnaryExpression 이 변수, 함수 인자, 함수 이름에 대한 직접 참조이면 SyntaxError 예외가 발생한다. 또한 strict 모드 코드에서 delete 가 발생하고 삭제하려는 프로퍼티가 { [[Configurable]]: false } 속성을 가지거나(또는 삭제 불가) 하면 TypeError 예외가 발생한다.

Note 2

4.c 단계에서 생성될 수 있는 객체는 위 추상 연산 및 보통 객체 [[Delete]] 내부 메서드 외부에서는 접근할 수 없다. 구현은 실제 객체 생성을 회피할 수도 있다.

13.5.2 void 연산자(The void Operator)

13.5.2.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

UnaryExpression : void UnaryExpression
  1. exprUnaryExpression 의 Evaluation 결과 (?) 로 둔다.
  2. GetValue(expr) 수행.
  3. undefined 반환.
Note

값을 사용하지 않더라도 관찰 가능한 부수효과가 있을 수 있으므로 GetValue 는 호출되어야 한다.

13.5.3 typeof 연산자(The typeof Operator)

13.5.3.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

UnaryExpression : typeof UnaryExpression
  1. valUnaryExpression 의 Evaluation 결과 (?) 로 둔다.
  2. valReference Record 이면
    1. IsUnresolvableReference(val) 가 true 이면 "undefined" 반환.
  3. val 을 ? GetValue(val) 로 설정.
  4. valundefined 이면 "undefined" 반환.
  5. valnull 이면 "object" 반환.
  6. val 이 String 이면 "string" 반환.
  7. val 이 Symbol 이면 "symbol" 반환.
  8. val 이 Boolean 이면 "boolean" 반환.
  9. val 이 Number 이면 "number" 반환.
  10. val 이 BigInt 이면 "bigint" 반환.
  11. 단언: val 은 Object.
  12. Normative Optional
    호스트가 웹 브라우저이거나 [[IsHTMLDDA]] 내부 슬롯 를 지원한다면
    1. val[[IsHTMLDDA]] 내부 슬롯을 가지면 "undefined" 반환.
  13. val[[Call]] 내부 메서드를 가지면 "function" 반환.
  14. "object" 반환.

13.5.4 단항 + 연산자(Unary + Operator)

Note

단항 + 연산자는 피연산자를 Number 타입으로 변환한다.

13.5.4.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

UnaryExpression : + UnaryExpression
  1. exprUnaryExpression 의 Evaluation 결과 (?) 로 둔다.
  2. ToNumber(? GetValue(expr)) 반환.

13.5.5 단항 - 연산자(Unary - Operator)

Note

단항 - 연산자는 피연산자를 수치 값으로 변환한 뒤 부호를 반전한다. +0𝔽 을 부정하면 -0𝔽, -0𝔽 을 부정하면 +0𝔽 이 된다.

13.5.5.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

UnaryExpression : - UnaryExpression
  1. exprUnaryExpression 의 Evaluation 결과 (?) 로 둔다.
  2. oldValue 를 ? ToNumeric(? GetValue(expr)) 로 둔다.
  3. oldValue 가 Number 이면
    1. Number::unaryMinus(oldValue) 반환.
  4. 그렇지 않으면
    1. 단언: oldValue 는 BigInt.
    2. BigInt::unaryMinus(oldValue) 반환.

13.5.6 비트 NOT 연산자(Bitwise NOT Operator) ( ~ )

13.5.6.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

UnaryExpression : ~ UnaryExpression
  1. exprUnaryExpression 의 Evaluation 결과 (?) 로 둔다.
  2. oldValue 를 ? ToNumeric(? GetValue(expr)) 로 둔다.
  3. oldValue 가 Number 이면
    1. Number::bitwiseNOT(oldValue) 반환.
  4. 그렇지 않으면
    1. 단언: oldValue 는 BigInt.
    2. BigInt::bitwiseNOT(oldValue) 반환.

13.5.7 논리 NOT 연산자(Logical NOT Operator) ( ! )

13.5.7.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

UnaryExpression : ! UnaryExpression
  1. exprUnaryExpression 의 Evaluation 결과 (?) 로 둔다.
  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
  • * 연산자는 피연산자의 곱(product)을 생성하는 곱셈을 수행한다.
  • / 연산자는 피연산자의 몫(quotient)을 생성하는 나눗셈을 수행한다.
  • % 연산자는 암묵적 나눗셈에서 피연산자의 나머지(remainder)를 구한다.

13.7.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

MultiplicativeExpression : MultiplicativeExpression MultiplicativeOperator ExponentiationExpression
  1. opTextMultiplicativeOperator 가 매칭한 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 덧셈 연산자 ( + ) (The Addition Operator)

Note

덧셈 연산자는 문자열 결합 또는 수치 덧셈을 수행한다.

13.8.1.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

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

13.8.2 뺄셈 연산자 ( - ) (The Subtraction Operator)

Note

- 연산자는 피연산자의 차(difference)를 생성하는 뺄셈을 수행한다.

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 왼쪽 시프트 연산자 ( << ) (The Left Shift Operator)

Note

왼쪽 피연산자를 오른쪽 피연산자가 지정한 비트 수만큼 비트 왼쪽 시프트한다.

13.9.1.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

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

13.9.2 부호 있는 오른쪽 시프트 연산자 ( >> ) (The Signed Right Shift Operator)

Note

왼쪽 피연산자를 오른쪽 피연산자가 지정한 비트 수만큼 부호 확장(bit sign-filling)하며 오른쪽 시프트한다.

13.9.2.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

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

13.9.3 부호 없는 오른쪽 시프트 연산자 ( >>> ) (The Unsigned Right Shift Operator)

Note

왼쪽 피연산자를 오른쪽 피연산자가 지정한 비트 수만큼 0 으로 채우며 오른쪽 시프트한다.

13.9.3.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

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

13.10 관계 연산자(Relational Operators)

Note 1

관계 연산자 평가 결과는 항상 Boolean 타입이며, 연산자가 명명한 관계가 두 피연산자 사이에서 성립하는지를 반영한다.

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] 문법 매개변수는 관계 표현식에서의 in 연산자를 for 문의 in 연산자와 혼동하지 않도록 필요하다.

13.10.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

RelationalExpression : RelationalExpression < ShiftExpression
  1. lRefRelationalExpression 의 Evaluation 결과 (?) 로 둔다.
  2. lVal 를 ? GetValue(lRef) 로 둔다.
  3. rRefShiftExpression 의 Evaluation 결과 (?) 로 둔다.
  4. rVal 를 ? GetValue(rRef) 로 둔다.
  5. r 를 ? IsLessThan(lVal, rVal, true) 로 둔다.
  6. rundefined 이면 false 반환; 그렇지 않으면 r 반환.
RelationalExpression : RelationalExpression > ShiftExpression
  1. lRef, lVal, rRef, rVal 를 위와 같이 얻는다.
  2. r 를 ? IsLessThan(rVal, lVal, false) 로 둔다.
  3. rundefined 이면 false 반환; 그렇지 않으면 r 반환.
RelationalExpression : RelationalExpression <= ShiftExpression
  1. lRef, lVal, rRef, rVal 를 얻는다.
  2. r 를 ? IsLessThan(rVal, lVal, false) 로 둔다.
  3. rtrue 또는 undefined 이면 false 반환; 그렇지 않으면 true 반환.
RelationalExpression : RelationalExpression >= ShiftExpression
  1. lRef, lVal, rRef, rVal 를 얻는다.
  2. r 를 ? IsLessThan(lVal, rVal, true) 로 둔다.
  3. rtrue 또는 undefined 이면 false 반환; 그렇지 않으면 true 반환.
RelationalExpression : RelationalExpression instanceof ShiftExpression
  1. lRef, lVal, rRef, rVal 를 얻는다.
  2. InstanceofOperator(lVal, rVal) 반환.
RelationalExpression : RelationalExpression in ShiftExpression
  1. lRef, lVal, rRef, rVal 를 얻는다.
  2. rVal 가 Object 가 아니면 TypeError 예외 throw.
  3. HasProperty(rVal, ? ToPropertyKey(lVal)) 반환.
RelationalExpression : PrivateIdentifier in ShiftExpression
  1. privateIdentifierPrivateIdentifier 의 StringValue 로 둔다.
  2. rRefShiftExpression 의 Evaluation 결과 (?) 로 둔다.
  3. rVal 를 ? GetValue(rRef) 로 둔다.
  4. rVal 가 Object 가 아니면 TypeError 예외 throw.
  5. privateEnv 를 실행 중인 실행 컨텍스트의 PrivateEnvironment 로 둔다.
  6. 단언: privateEnvnull 이 아님.
  7. privateNameResolvePrivateIdentifier(privateEnv, privateIdentifier) 로 둔다.
  8. PrivateElementFind(rVal, privateName) 이 empty 가 아니면 true 반환.
  9. false 반환.

13.10.2 InstanceofOperator ( V, target )

The abstract operation InstanceofOperator takes arguments V (an ECMAScript language value) and target (an ECMAScript language value) and returns Boolean 을 담는 정상 완료 또는 throw completion. target%Symbol.hasInstance% 메서드를 조회하거나, 없다면 target"prototype" 프로퍼티 값이 V 의 프로토타입 체인에 존재하는지 확인하여 Vtarget 의 인스턴스인지 결정하는 일반 알고리즘을 구현한다. It performs the following steps when called:

  1. target 이 Object 가 아니면 TypeError 예외 throw.
  2. instOfHandler 를 ? GetMethod(target, %Symbol.hasInstance%) 로 둔다.
  3. instOfHandlerundefined 가 아니면
    1. ToBoolean(? Call(instOfHandler, target, « V »)) 반환.
  4. IsCallable(target) 이 false 이면 TypeError 예외 throw.
  5. OrdinaryHasInstance(target, V) 반환.
Note

45 단계는 %Symbol.hasInstance% 를 사용하지 않던 이전 ECMAScript 판과의 호환성을 제공한다. 객체가 %Symbol.hasInstance% 를 정의하거나 상속하지 않으면 기본 instanceof 의미론을 사용한다.

13.11 동등 연산자(Equality Operators)

Note

동등 연산자 평가 결과는 항상 Boolean 타입이며, 연산자가 명명한 관계가 두 피연산자 사이에서 성립하는지를 반영한다.

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. lRefEqualityExpression 의 Evaluation 결과 (?) 로 둔다.
  2. lVal 를 ? GetValue(lRef) 로 둔다.
  3. rRefRelationalExpression 의 Evaluation 결과 (?) 로 둔다.
  4. rVal 를 ? GetValue(rRef) 로 둔다.
  5. IsLooselyEqual(rVal, lVal) 반환.
EqualityExpression : EqualityExpression != RelationalExpression
  1. lRef, lVal, rRef, rVal 를 얻는다.
  2. r 를 ? IsLooselyEqual(rVal, lVal) 로 둔다.
  3. rtrue 이면 false 반환; 그렇지 않으면 true 반환.
EqualityExpression : EqualityExpression === RelationalExpression
  1. lRef, lVal, rRef, rVal 를 얻는다.
  2. IsStrictlyEqual(rVal, lVal) 반환.
EqualityExpression : EqualityExpression !== RelationalExpression
  1. lRef, lVal, rRef, rVal 를 얻는다.
  2. rIsStrictlyEqual(rVal, lVal) 로 둔다.
  3. rtrue 이면 false 반환; 그렇지 않으면 true 반환.
Note 1

위 동등성 정의에 따라:

  • 문자열 비교를 강제하려면: \`${a}\` == \`${b}\`.
  • 수치 비교를 강제하려면: +a == +b.
  • Boolean 비교를 강제하려면: !a == !b.
Note 2

동등 연산자는 다음 불변식을 유지한다:

  • A != B!(A == B) 와 동등하다.
  • A == B 는 (평가 순서 제외) B == A 와 동등하다.
Note 3

동등 연산자는 항상 추이적(transitive)이지는 않다. 예를 들어 동일한 String 값을 나타내는 서로 다른 두 String 객체가 있을 수 있고, 각 객체는 == 연산자에 의해 그 String 값과는 같지만 서로는 같지 않을 수 있다. 예:

  • new String("a") == "a""a" == new String("a") 는 둘 다 true.
  • new String("a") == new String("a")false.
Note 4

문자열 비교는 코드 유닛 값 시퀀스의 단순 동등성 검사만을 사용한다. 유니코드 명세에 정의된 더 복잡하고 의미 지향적인 문자/문자열 동등성 또는 정렬 순서를 사용하지 않는다. 따라서 유니코드 표준에 따라 정규적으로 동등한 String 값이라도 서로 다르다고 나올 수 있다. 사실상 이 알고리즘은 두 String 이 이미 정규화(normalized)되어 있다고 가정한다.

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

&& 또는 || 연산자가 생성하는 값은 반드시 Boolean 타입일 필요가 없다. 결과 값은 항상 두 피연산자 표현식 중 하나의 값이다.

13.13.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

LogicalANDExpression : LogicalANDExpression && BitwiseORExpression
  1. lRefLogicalANDExpression 의 Evaluation 결과 (?) 로 둔다.
  2. lVal 를 ? GetValue(lRef) 로 둔다.
  3. ToBoolean(lVal) 이 false 이면 lVal 반환.
  4. rRefBitwiseORExpression 의 Evaluation 결과 (?) 로 둔다.
  5. GetValue(rRef) 반환.
LogicalORExpression : LogicalORExpression || LogicalANDExpression
  1. lRefLogicalORExpression 의 Evaluation 결과 (?) 로 둔다.
  2. lVal 를 ? GetValue(lRef) 로 둔다.
  3. ToBoolean(lVal) 이 true 이면 lVal 반환.
  4. rRefLogicalANDExpression 의 Evaluation 결과 (?) 로 둔다.
  5. GetValue(rRef) 반환.
CoalesceExpression : CoalesceExpressionHead ?? BitwiseORExpression
  1. lRefCoalesceExpressionHead 의 Evaluation 결과 (?) 로 둔다.
  2. lVal 를 ? GetValue(lRef) 로 둔다.
  3. lValundefined 또는 null 이면
    1. rRefBitwiseORExpression 의 Evaluation 결과 (?) 로 둔다.
    2. GetValue(rRef) 반환.
  4. 그렇지 않으면
    1. lVal 반환.

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 문법은 C 및 Java 와 약간 다르다. C 와 Java 는 두 번째 부분식을 Expression 으로 허용하지만 세 번째 부분식을 ConditionalExpression 으로 제한한다. ECMAScript 에서 이러한 차이를 둔 동기는 (1) 조건부의 어느 한 쪽 (arm) 에서도 할당 표현식을 다룰 수 있게 하고 (2) 가운데 표현식이 쉼표 표현식인 혼란스럽고 거의 쓸모없는 경우를 제거하기 위함이다.

13.14.1 런타임 의미론: 평가(Runtime Semantics: Evaluation)

ConditionalExpression : ShortCircuitExpression ? AssignmentExpression : AssignmentExpression
  1. lRefShortCircuitExpression 의 Evaluation 결과 (?) 로 둔다.
  2. lValToBoolean(? GetValue(lRef)) 로 둔다.
  3. lValtrue 이면
    1. trueRef 를 첫 번째 AssignmentExpression 의 Evaluation 결과 (?) 로 둔다.
    2. GetValue(trueRef) 반환.
  4. 그렇지 않으면
    1. falseRef 를 두 번째 AssignmentExpression 의 Evaluation 결과 (?) 로 둔다.
    2. 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. lRefLeftHandSideExpression 의 Evaluation 결과 (?) 로 둔다.
    2. LeftHandSideExpression 의 AssignmentTargetType 이 web-compat 이면 ReferenceError 예외를 throw.
    3. IsAnonymousFunctionDefinition(AssignmentExpression) 이 true 이고 IsIdentifierRef(LeftHandSideExpression) 가 true 이면
      1. lhsLeftHandSideExpression 의 StringValue 로 둔다.
      2. rValAssignmentExpression 의 NamedEvaluation(lhs) 결과 (?) 로 둔다.
    4. 그렇지 않으면
      1. rRefAssignmentExpression 의 Evaluation 결과 (?) 로 둔다.
      2. rVal 를 ? GetValue(rRef) 로 둔다.
    5. PutValue(lRef, rVal) 수행.
    6. rVal 반환.
  2. assignmentPatternLeftHandSideExpression 이 커버하는 AssignmentPattern 으로 둔다.
  3. rRefAssignmentExpression 의 Evaluation 결과 (?) 로 둔다.
  4. rVal 를 ? GetValue(rRef) 로 둔다.
  5. assignmentPattern 의 DestructuringAssignmentEvaluation(rVal) 를 ? 로 수행.
  6. rVal 반환.
AssignmentExpression : LeftHandSideExpression AssignmentOperator AssignmentExpression
  1. lRefLeftHandSideExpression 의 Evaluation 결과 (?) 로 둔다.
  2. LeftHandSideExpression 의 AssignmentTargetType 이 web-compat 이면 ReferenceError 예외 throw.
  3. lVal 를 ? GetValue(lRef) 로 둔다.
  4. rRefAssignmentExpression 의 Evaluation 결과 (?) 로 둔다.
  5. rVal 를 ? GetValue(rRef) 로 둔다.
  6. assignmentOpTextAssignmentOperator 가 매칭한 소스 텍스트로 둔다.
  7. opText 를 아래 표에서 assignmentOpText 에 연관된 유니코드 코드 포인트 시퀀스로 둔다.
    assignmentOpText opText
    **= **
    *= *
    /= /
    %= %
    += +
    -= -
    <<= <<
    >>= >>
    >>>= >>>
    &= &
    ^= ^
    |= |
  8. r 를 ? ApplyStringOrNumericBinaryOperator(lVal, opText, rVal) 로 둔다.
  9. PutValue(lRef, r) 수행.
  10. r 반환.
AssignmentExpression : LeftHandSideExpression &&= AssignmentExpression
  1. lRefLeftHandSideExpression 의 Evaluation 결과 (?) 로 둔다.
  2. lVal 를 ? GetValue(lRef) 로 둔다.
  3. ToBoolean(lVal) 가 false 이면 lVal 반환.
  4. IsAnonymousFunctionDefinition(AssignmentExpression) 이 true 이고 IsIdentifierRef(LeftHandSideExpression) 가 true 이면
    1. lhsLeftHandSideExpression 의 StringValue 로 둔다.
    2. rValAssignmentExpression 의 NamedEvaluation(lhs) 결과 (?) 로 둔다.
  5. 그렇지 않으면
    1. rRefAssignmentExpression 의 Evaluation 결과 (?) 로 둔다.
    2. rVal 를 ? GetValue(rRef) 로 둔다.
  6. PutValue(lRef, rVal) 수행.
  7. rVal 반환.
AssignmentExpression : LeftHandSideExpression ||= AssignmentExpression
  1. lRefLeftHandSideExpression 의 Evaluation 결과 (?) 로 둔다.
  2. lVal 를 ? GetValue(lRef) 로 둔다.
  3. ToBoolean(lVal) 가 true 이면 lVal 반환.
  4. IsAnonymousFunctionDefinition(AssignmentExpression) 이 true 이고 IsIdentifierRef(LeftHandSideExpression) 가 true 이면
    1. lhsLeftHandSideExpression 의 StringValue 로 둔다.
    2. rValAssignmentExpression 의 NamedEvaluation(lhs) 결과 (?) 로 둔다.
  5. 그렇지 않으면
    1. rRefAssignmentExpression 의 Evaluation 결과 (?) 로 둔다.
    2. rVal 를 ? GetValue(rRef) 로 둔다.
  6. PutValue(lRef, rVal) 수행.
  7. rVal 반환.
AssignmentExpression : LeftHandSideExpression ??= AssignmentExpression
  1. lRefLeftHandSideExpression 의 Evaluation 결과 (?) 로 둔다.
  2. lVal 를 ? GetValue(lRef) 로 둔다.
  3. lValundefinednull 도 아니면 lVal 반환.
  4. IsAnonymousFunctionDefinition(AssignmentExpression) 이 true 이고 IsIdentifierRef(LeftHandSideExpression) 가 true 이면
    1. lhsLeftHandSideExpression 의 StringValue 로 둔다.
    2. rValAssignmentExpression 의 NamedEvaluation(lhs) 결과 (?) 로 둔다.
  5. 그렇지 않으면
    1. rRefAssignmentExpression 의 Evaluation 결과 (?) 로 둔다.
    2. rVal 를 ? GetValue(rRef) 로 둔다.
  6. PutValue(lRef, rVal) 수행.
  7. rVal 반환.
Note

이 표현식이 strict 모드 코드 내에 나타날 때 단계 1.e, 3, 2, 2, 2lRef 가 해석 불가능한(unresolvable) reference 이면 런타임 오류이며 ReferenceError 예외가 발생한다. 또한 단계 9, 6, 6, 6lRef 가 { [[Writable]]: false } 특성을 가진 데이터 프로퍼티, { [[Set]]: undefined } 특성을 가진 접근자 프로퍼티, 또는 IsExtensiblefalse 를 반환하는 객체의 존재하지 않는 프로퍼티라면 TypeError 예외가 발생한다.

13.15.3 ApplyStringOrNumericBinaryOperator ( lVal, opText, rVal )

The abstract operation ApplyStringOrNumericBinaryOperator takes arguments lVal (an ECMAScript language value), opText (**, *, /, %, +, -, <<, >>, >>>, &, ^, or |), and rVal (an ECMAScript language value) and returns 정상 완료 시 String, BigInt 또는 Number 중 하나 또는 throw completion. It performs the following steps when called:

  1. opText+ 이면
    1. lPrim 을 ? ToPrimitive(lVal) 로 둔다.
    2. rPrim 을 ? ToPrimitive(rVal) 로 둔다.
    3. lPrim 이 String 이거나 rPrim 이 String 이면
      1. lStr 을 ? ToString(lPrim) 로 둔다.
      2. rStr 을 ? ToString(rPrim) 로 둔다.
      3. lStrrStr 의 문자열 연결을 반환.
    4. lVallPrim 으로 설정.
    5. rValrPrim 으로 설정.
  2. NOTE: 이 시점부터는 수치 연산이어야 한다.
  3. lNum 을 ? ToNumeric(lVal) 로 둔다.
  4. rNum 을 ? ToNumeric(rVal) 로 둔다.
  5. SameType(lNum, rNum) 이 false 이면 TypeError 예외 throw.
  6. lNum 이 BigInt 이면
    1. opText** 이면 ? BigInt::exponentiate(lNum, rNum) 반환.
    2. opText/ 이면 ? BigInt::divide(lNum, rNum) 반환.
    3. opText% 이면 ? BigInt::remainder(lNum, rNum) 반환.
    4. opText>>> 이면 ? BigInt::unsignedRightShift(lNum, rNum) 반환.
    5. operation 을 아래 표에서 opText 에 연관된 추상 연산으로 둔다.
      opText operation
      * BigInt::multiply
      + BigInt::add
      - BigInt::subtract
      << BigInt::leftShift
      >> BigInt::signedRightShift
      & BigInt::bitwiseAND
      ^ BigInt::bitwiseXOR
      | BigInt::bitwiseOR
  7. 그렇지 않으면
    1. 단언: lNum 은 Number.
    2. operation 을 아래 표에서 opText 에 연관된 추상 연산으로 둔다.
      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(lNum, rNum) 반환.
Note 1

단계 1.a, 1.bToPrimitive 호출에는 hint 가 제공되지 않는다. 표준 객체 중 Date 를 제외한 모든 객체는 hint 부재를 number 가 주어진 것처럼 처리하고 Date 는 string 처럼 처리한다. 특수(exotic) 객체는 다른 방식으로 처리할 수 있다.

Note 2

단계 1.cIsLessThan 알고리즘의 단계 3 와 달리 논리 AND 대신 논리 OR 를 사용한다.

13.15.4 EvaluateStringOrNumericBinaryExpression ( leftOperand, opText, rightOperand )

The abstract operation EvaluateStringOrNumericBinaryExpression takes arguments leftOperand (a Parse Node), opText (a sequence of Unicode code points), and rightOperand (a Parse Node) and returns 정상 완료 시 String, BigInt 또는 Number 중 하나 또는 abrupt completion. It performs the following steps when called:

  1. lRefleftOperand 의 Evaluation 결과 (?) 로 둔다.
  2. lVal 를 ? GetValue(lRef) 로 둔다.
  3. rRefrightOperand 의 Evaluation 결과 (?) 로 둔다.
  4. rVal 를 ? GetValue(rRef) 로 둔다.
  5. ApplyStringOrNumericBinaryOperator(lVal, opText, rVal) 반환.

13.15.5 구조 분해 할당(Destructuring Assignment)

보충 문법(Supplemental Syntax)

특정 상황에서 다음 생성물 인스턴스를 처리할 때
AssignmentExpression : LeftHandSideExpression = AssignmentExpression
LeftHandSideExpression 의 해석은 아래 문법을 사용해 정밀화된다:

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 런타임 의미론: DestructuringAssignmentEvaluation : 정상 완료 시 unused 또는 abrupt completion

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:

ObjectAssignmentPattern : { }
  1. RequireObjectCoercible(value) 수행.
  2. unused 반환.
ObjectAssignmentPattern : { AssignmentPropertyList } { AssignmentPropertyList , }
  1. RequireObjectCoercible(value) 수행.
  2. AssignmentPropertyList 의 PropertyDestructuringAssignmentEvaluation(value) 를 ? 로 수행.
  3. unused 반환.
ObjectAssignmentPattern : { AssignmentRestProperty }
  1. RequireObjectCoercible(value) 수행.
  2. excludedNames 를 새 빈 List 로 둔다.
  3. AssignmentRestProperty 의 RestDestructuringAssignmentEvaluation(value, excludedNames) 를 ? 로 반환.
ObjectAssignmentPattern : { AssignmentPropertyList , AssignmentRestProperty }
  1. RequireObjectCoercible(value) 수행.
  2. excludedNamesAssignmentPropertyList 의 PropertyDestructuringAssignmentEvaluation(value) 결과 (?) 로 둔다.
  3. AssignmentRestProperty 의 RestDestructuringAssignmentEvaluation(value, excludedNames) 를 ? 로 반환.
ArrayAssignmentPattern : [ ]
  1. iteratorRecord 를 ? GetIterator(value, sync) 로 둔다.
  2. IteratorClose(iteratorRecord, NormalCompletion(unused)) 반환.
ArrayAssignmentPattern : [ Elision ]
  1. iteratorRecord 를 ? GetIterator(value, sync) 로 둔다.
  2. resultCompletion(IteratorDestructuringAssignmentEvaluation(Elision, iteratorRecord)) 로 둔다.
  3. iteratorRecord.[[Done]]false 이면 ? IteratorClose(iteratorRecord, result) 반환.
  4. result 반환.
ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
  1. iteratorRecord 를 ? GetIterator(value, sync) 로 둔다.
  2. Elision 이 존재하면
    1. statusCompletion(IteratorDestructuringAssignmentEvaluation(Elision, iteratorRecord)) 로 둔다.
    2. statusabrupt completion 이면
      1. 단언: iteratorRecord.[[Done]]true.
      2. status 반환.
  3. resultCompletion(IteratorDestructuringAssignmentEvaluation(AssignmentRestElement, iteratorRecord)) 로 둔다.
  4. iteratorRecord.[[Done]]false 이면 ? IteratorClose(iteratorRecord, result) 반환.
  5. result 반환.
ArrayAssignmentPattern : [ AssignmentElementList ]
  1. iteratorRecord 를 ? GetIterator(value, sync) 로 둔다.
  2. resultCompletion(IteratorDestructuringAssignmentEvaluation(AssignmentElementList, iteratorRecord)) 로 둔다.
  3. iteratorRecord.[[Done]]false 이면 ? IteratorClose(iteratorRecord, result) 반환.
  4. result 반환.
ArrayAssignmentPattern : [ AssignmentElementList , Elisionopt AssignmentRestElementopt ]
  1. iteratorRecord 를 ? GetIterator(value, sync) 로 둔다.
  2. statusCompletion(IteratorDestructuringAssignmentEvaluation(AssignmentElementList, iteratorRecord)) 로 둔다.
  3. statusabrupt completion 이면
    1. iteratorRecord.[[Done]]false 이면 ? IteratorClose(iteratorRecord, status) 반환.
    2. status 반환.
  4. Elision 이 존재하면
    1. statusCompletion(IteratorDestructuringAssignmentEvaluation(Elision, iteratorRecord)) 로 설정.
    2. statusabrupt completion 이면
      1. 단언: iteratorRecord.[[Done]]true.
      2. status 반환.
  5. AssignmentRestElement 가 존재하면
    1. statusCompletion(IteratorDestructuringAssignmentEvaluation(AssignmentRestElement, iteratorRecord)) 로 설정.
  6. iteratorRecord.[[Done]]false 이면 ? IteratorClose(iteratorRecord, status) 반환.
  7. status 반환.

13.15.5.3 런타임 의미론: PropertyDestructuringAssignmentEvaluation : 정상 완료 시 프로퍼티 키 List 또는 abrupt completion

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. 모든 구조 분해된 프로퍼티 키의 목록을 수집한다. It is defined piecewise over the following productions:

AssignmentPropertyList : AssignmentPropertyList , AssignmentProperty
  1. propertyNamesAssignmentPropertyList 의 PropertyDestructuringAssignmentEvaluation(value) 결과 (?) 로 둔다.
  2. nextNamesAssignmentProperty 의 PropertyDestructuringAssignmentEvaluation(value) 결과 (?) 로 둔다.
  3. propertyNamesnextNames 의 리스트 연결 반환.
AssignmentProperty : IdentifierReference Initializeropt
  1. PIdentifierReference 의 StringValue 로 둔다.
  2. lRef 를 ? ResolveBinding(P) 로 둔다.
  3. v 를 ? GetV(value, P) 로 둔다.
  4. Initializer 가 존재하고 vundefined 이면
    1. IsAnonymousFunctionDefinition(Initializer) 이 true 이면
      1. vInitializer 의 NamedEvaluation(P) 결과 (?) 로 설정.
    2. 그렇지 않으면
      1. defaultValueInitializer 의 Evaluation 결과 (?) 로 둔다.
      2. v 를 ? GetValue(defaultValue) 로 둔다.
  5. PutValue(lRef, v) 수행.
  6. « P » 반환.
AssignmentProperty : PropertyName : AssignmentElement
  1. namePropertyName 의 Evaluation 결과 (?) 로 둔다.
  2. AssignmentElement 의 KeyedDestructuringAssignmentEvaluation(value, name) 를 ? 로 수행.
  3. « name » 반환.

13.15.5.4 런타임 의미론: RestDestructuringAssignmentEvaluation : 정상 완료 시 unused 또는 abrupt completion

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:

AssignmentRestProperty : ... DestructuringAssignmentTarget
  1. lRefDestructuringAssignmentTarget 의 Evaluation 결과 (?) 로 둔다.
  2. restObjOrdinaryObjectCreate(%Object.prototype%) 로 둔다.
  3. CopyDataProperties(restObj, value, excludedNames) 수행.
  4. PutValue(lRef, restObj) 반환.

13.15.5.5 런타임 의미론: IteratorDestructuringAssignmentEvaluation : 정상 완료 시 unused 또는 abrupt completion

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:

AssignmentElementList : AssignmentElisionElement
  1. ? IteratorDestructuringAssignmentEvaluation(AssignmentElisionElement, iteratorRecord) 반환.
AssignmentElementList : AssignmentElementList , AssignmentElisionElement
  1. ? IteratorDestructuringAssignmentEvaluation(AssignmentElementList, iteratorRecord) 수행.
  2. ? IteratorDestructuringAssignmentEvaluation(AssignmentElisionElement, iteratorRecord) 반환.
AssignmentElisionElement : AssignmentElement
  1. ? IteratorDestructuringAssignmentEvaluation(AssignmentElement, iteratorRecord) 반환.
AssignmentElisionElement : Elision AssignmentElement
  1. ? IteratorDestructuringAssignmentEvaluation(Elision, iteratorRecord) 수행.
  2. ? IteratorDestructuringAssignmentEvaluation(AssignmentElement, iteratorRecord) 반환.
Elision : ,
  1. iteratorRecord.[[Done]]false 이면
    1. IteratorStep(iteratorRecord) 수행.
  2. unused 반환.
Elision : Elision ,
  1. ? IteratorDestructuringAssignmentEvaluation(Elision, iteratorRecord) 수행.
  2. iteratorRecord.[[Done]]false 이면
    1. IteratorStep(iteratorRecord) 수행.
  3. unused 반환.
AssignmentElement : DestructuringAssignmentTarget Initializeropt
  1. DestructuringAssignmentTargetObjectLiteralArrayLiteral 도 아니면
    1. lRefDestructuringAssignmentTarget 의 Evaluation 결과 (?) 로 둔다.
  2. valueundefined 로 둔다.
  3. iteratorRecord.[[Done]]false 이면
    1. next 를 ? IteratorStepValue(iteratorRecord) 로 둔다.
    2. nextdone 이 아니면
      1. valuenext 로 설정.
  4. Initializer 가 존재하고 valueundefined 이면
    1. IsAnonymousFunctionDefinition(Initializer) 이 true 이고 IsIdentifierRef(DestructuringAssignmentTarget) 가 true 이면
      1. targetDestructuringAssignmentTarget 의 StringValue 로 둔다.
      2. vInitializer 의 NamedEvaluation(target) 결과 (?) 로 둔다.
    2. 그렇지 않으면
      1. defaultValueInitializer 의 Evaluation 결과 (?) 로 둔다.
      2. v 를 ? GetValue(defaultValue) 로 둔다.
  5. 그렇지 않으면
    1. vvalue 로 둔다.
  6. DestructuringAssignmentTargetObjectLiteral 이거나 ArrayLiteral 이면
    1. nestedAssignmentPatternDestructuringAssignmentTarget 이 커버하는 AssignmentPattern 으로 둔다.
    2. ? DestructuringAssignmentEvaluation(nestedAssignmentPattern, v) 반환.
  7. PutValue(lRef, v) 반환.
Note

DestructuringAssignmentTarget 이 구조 분해 패턴이 아닌 경우 그것을 먼저 평가한 뒤 iterator 접근이나 Initializer 평가가 수행되어 좌→우 평가 순서가 유지된다.

AssignmentRestElement : ... DestructuringAssignmentTarget
  1. DestructuringAssignmentTargetObjectLiteralArrayLiteral 도 아니면
    1. lRefDestructuringAssignmentTarget 의 Evaluation 결과 (?) 로 둔다.
  2. A 를 ! ArrayCreate(0) 로 둔다.
  3. n = 0.
  4. iteratorRecord.[[Done]]false 인 동안 반복
    1. next 를 ? IteratorStepValue(iteratorRecord) 로 둔다.
    2. nextdone 이 아니면
      1. CreateDataPropertyOrThrow(A, ! ToString(𝔽(n)), next) 수행.
      2. n = n + 1.
  5. DestructuringAssignmentTargetObjectLiteralArrayLiteral 도 아니면
    1. PutValue(lRef, A) 반환.
  6. nestedAssignmentPatternDestructuringAssignmentTarget 이 커버하는 AssignmentPattern 으로 둔다.
  7. ? DestructuringAssignmentEvaluation(nestedAssignmentPattern, A) 반환.

13.15.5.6 런타임 의미론: KeyedDestructuringAssignmentEvaluation : 정상 완료 시 unused 또는 abrupt completion

The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:

AssignmentElement : DestructuringAssignmentTarget Initializeropt
  1. DestructuringAssignmentTargetObjectLiteralArrayLiteral 도 아니면
    1. lRefDestructuringAssignmentTarget 의 Evaluation 결과 (?) 로 둔다.
  2. v 를 ? GetV(value, propertyName) 로 둔다.
  3. Initializer 가 존재하고 vundefined 이면
    1. IsAnonymousFunctionDefinition(Initializer) 이 true 이고 IsIdentifierRef(DestructuringAssignmentTarget) 가 true 이면
      1. targetDestructuringAssignmentTarget 의 StringValue 로 둔다.
      2. rhsValueInitializer 의 NamedEvaluation(target) 결과 (?) 로 둔다.
    2. 그렇지 않으면
      1. defaultValueInitializer 의 Evaluation 결과 (?) 로 둔다.
      2. rhsValue 를 ? GetValue(defaultValue) 로 둔다.
  4. 그렇지 않으면
    1. rhsValuev 로 둔다.
  5. DestructuringAssignmentTargetObjectLiteral 이거나 ArrayLiteral 이면
    1. assignmentPatternDestructuringAssignmentTarget 이 커버하는 AssignmentPattern 으로 둔다.
    2. ? DestructuringAssignmentEvaluation(assignmentPattern, rhsValue) 반환.
  6. PutValue(lRef, 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. lRefExpression 의 Evaluation 결과 (?) 로 둔다.
  2. GetValue(lRef) 수행.
  3. rRefAssignmentExpression 의 Evaluation 결과 (?) 로 둔다.
  4. GetValue(rRef) 반환.
Note

값을 사용하지 않더라도 관찰 가능한 부수 효과가 있을 수 있으므로 GetValue 는 호출되어야 한다.