?um/p1-90`
제어가
eval 함수 호출들은 모두
값 1을 반환한다:
eval("1;;;;;")
eval("1;{}")
eval("1;var a;")
The abstract operation BlockDeclarationInstantiation takes arguments code (a Parse Node) and env (a
호출되면 다음 단계를 수행한다:
let과 const 선언은 현재 실행 중인 let 선언 안의
const
선언에서는 결코 나타나지 않음이 보장된다.
var 문장은 현재 실행 중인
The syntax-directed operation PropertyBindingInitialization takes arguments value (an ECMAScript language value) and environment (an
The syntax-directed operation RestBindingInitialization takes arguments value (an ECMAScript language value), environment (an
The syntax-directed operation KeyedBindingInitialization takes arguments value (an ECMAScript language value), environment (an
environment에
It is defined piecewise over the following productions:
function 또는 class async function으로 시작할 수 없는데, 그러면
let [로
시작할 수 없는데, 그러면 첫 번째 let
if 문else] 선행탐색 제한은 고전적인 "dangling else"
문제를 통상적인 방식으로 해결한다. 즉, 연관된 if의 선택이 달리
모호할 때, else는 후보 if들 중 가장 가까운(가장 안쪽의) 것과
연관된다
이 규칙은
The abstract operation LoopContinues takes arguments completion (a
The syntax-directed operation LoopEvaluation takes argument labelSet (a
do-while 문
이 규칙은
The syntax-directed operation DoWhileLoopEvaluation takes argument labelSet (a
while 문
이 규칙은
The syntax-directed operation WhileLoopEvaluation takes argument labelSet (a
for 문
이 규칙은
The syntax-directed operation ForLoopEvaluation takes argument labelSet (a
The abstract operation ForBodyEvaluation takes arguments test (an
The abstract operation CreatePerIterationEnvironment takes argument perIterationBindings (a
for-in, for-of, for-await-of 문
이 절은 부록
이 규칙은
The syntax-directed operation IsDestructuring takes no arguments and returns a Boolean. It is defined piecewise over the following productions:
이 절은 부록
The syntax-directed operation ForDeclarationBindingInitialization takes arguments value (an ECMAScript language value) and environment (an
The syntax-directed operation ForDeclarationBindingInstantiation takes argument environment (a
The syntax-directed operation ForInOfLoopEvaluation takes argument labelSet (a
이 절은 부록
The abstract operation ForIn/OfHeadEvaluation takes arguments uninitializedBoundNames (a
The abstract operation ForIn/OfBodyEvaluation takes arguments lhs (a Parse Node), stmt (a
The abstract operation EnumerateObjectProperties takes argument obj (an Object) and returns an
next 메서드를 가진 이터레이터 객체를 반환한다. 이터레이터
객체는 ECMAScript 코드에서 직접 접근할 수 없다. 프로퍼티를
열거하는 방식과 순서는 명시되지 않지만 아래에 명시된 규칙에는
부합해야 한다.
이 이터레이터의 throw 및 return 메서드는 next 메서드는 프로퍼티 키가
이터레이터 값으로 반환되어야 하는지를 결정하기 위해 객체
프로퍼티를 처리한다. 반환되는 프로퍼티 키에는 Symbol인 키는
포함되지 않는다. 대상 객체의 프로퍼티는 열거 도중 삭제될 수 있다.
이터레이터의 next 메서드가 처리하기 전에 삭제된 프로퍼티는
무시된다. 열거 도중 대상 객체에 새 프로퍼티가 추가되더라도, 새로
추가된 프로퍼티가 현재 진행 중인 열거에서 처리된다는 보장은 없다.
어떤 프로퍼티 이름이든 한 번의 열거에서 이터레이터의 next
메서드에 의해 최대 한 번만 반환된다.
대상 객체의 프로퍼티 열거에는 그 프로토타입, 프로토타입의
프로토타입 등도 재귀적으로 포함된다; 하지만 프로토타입의 프로퍼티는,
이터레이터의 next 메서드에 의해 이미 처리된 프로퍼티와 같은
이름을 가지면 처리되지 않는다. 프로토타입 객체의 프로퍼티가 이미
처리되었는지 결정할 때 [[Enumerable]] 속성 값은 고려되지 않는다.
프로토타입 객체의 열거 가능한 프로퍼티 이름은 그 프로토타입 객체를
인수로 전달하여 EnumerateObjectProperties를 호출함으로써 얻어져야
한다. EnumerateObjectProperties는 대상 객체의 자체 프로퍼티 키를
[[OwnPropertyKeys]] 내부 메서드를 호출하여 얻어야 한다. 대상
객체의 프로퍼티 속성은 [[GetOwnProperty]] 내부 메서드를 호출하여
얻어야 한다.
추가로, obj와 그 프로토타입 체인 안의 어떤 객체도 Proxy 이색
객체,
ECMAScript 구현은
다음은 이 규칙들에 부합하는 ECMAScript generator 함수의 정보성 정의이다:
function* EnumerateObjectProperties(obj) {
const visited = new Set();
for (const key of Reflect.ownKeys(obj)) {
if (typeof key === "symbol") continue;
const desc = Reflect.getOwnPropertyDescriptor(obj, key);
if (desc) {
visited.add(key);
if (desc.enumerable) yield key;
}
}
const proto = Reflect.getPrototypeOf(obj);
if (proto === null) return;
for (const protoKey of EnumerateObjectProperties(proto)) {
if (!visited.has(protoKey)) yield protoKey;
}
}
For-In Iterator
는 특정 객체에 대한 특정한 순회를 나타내는 객체이다. For-In
Iterator 객체는 ECMAScript 코드에서 직접 접근할 수 없으며;
The abstract operation CreateForInIterator takes argument object (an Object) and returns a
%ForInIteratorPrototype% 객체는:
| 내부 슬롯 | 타입 | 설명 |
|---|---|---|
| [[Object]] | an Object | 프로퍼티가 순회되고 있는 Object 값. |
| [[ObjectWasVisited]] | a Boolean |
이 이터레이터가 [[Object]]에 대해 [[OwnPropertyKeys]]를
호출했으면 |
| [[VisitedKeys]] |
a |
지금까지 이 이터레이터에 의해 방출된 값들. |
| [[RemainingKeys]] |
a |
현재 객체에 대해 아직 방출되지 않은 값들. 이 값들은 그
프로토타입의 프로퍼티를 순회하기 전에 방출된다
(프로토타입이 |
continue 문static 초기화 블록
경계를 넘지 않아야 함), Syntax Error이다.
break 문static 초기화 블록 경계를 넘지 않아야 함),
Syntax Error이다.
return 문
return 문은 함수가 실행을 중단하게 하며, 대부분의 경우 호출자에게
값을 반환한다. return 문은 주변
문맥에 따라 실제로 호출자에게 값을 반환하지 않을 수도 있다. 예를 들어
try 블록 안에서는 return 문의 finally
블록 평가 중 다른
with 문
with 문의 사용은 새로운 ECMAScript 코드에서는 권장되지
않는다.
with 문은 계산된 객체에 대한
두 번째 규칙은
제어가 포함된
switch 문
The syntax-directed operation CaseBlockEvaluation takes argument input (an ECMAScript language value) and returns either a
The abstract operation CaseClauseIsSelected takes arguments constructor (a
이 연산은 constructor의
제어가
break 및 continue 문과 함께만 사용된다. ECMAScript에는 goto
문이 없다.
The abstract operation IsLabelledFunction takes argument stmt (a
The syntax-directed operation LabelledEvaluation takes argument labelSet (a
throw 문try 문
try 문은 런타임 오류나 throw 문처럼 예외적인 조건이 발생할 수
있는 코드 블록을 둘러싼다. catch 절은 예외 처리 코드를 제공한다.
catch 절이 예외를 포착하면, 그
The syntax-directed operation CatchClauseEvaluation takes argument thrownValue (an ECMAScript language value) and returns either a
제어가
debugger 문