?
u
m
/
p
1-9
0
`
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
선언은 실행 중인 실행 컨텍스트의 LexicalEnvironment 에 스코프를 가지는 변수를 정의한다. 변수는 포함 let
선언에서
정적 의미론 규칙은 이 형태의 const
선언에서는 발생하지 않음을 보장한다.
var
문은 실행 중인 실행 컨텍스트의 VariableEnvironment 에 스코프를 가지는 변수를 선언한다. Var 변수는
The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. 바인딩된 모든
The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:
The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS.
environment 에
It is defined piecewise over the following productions:
function
또는 class
로 시작할 수 없는데 그러면 async function
으로 시작할 수 없는 이유는 let [
두 토큰 시퀀스로 시작할 수 없는 이유는 첫 let
if
문else
] 는 고전적인 “dangling else” 문제를 통상 방식으로 해결한다. 즉 어떤 else
가 어느 if
와 연관될지 모호할 때 가장 안쪽(가장 가까운)의 if
와 결합된다.The abstract operation LoopContinues takes arguments completion (a
The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:
do
-while
문The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:
while
문The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:
for
문The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:
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 UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:
이 절은 부록
The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS.
It is defined piecewise over the following productions:
The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:
The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:
이 절은 부록
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 O (an Object) and returns
next
메서드를 가진 이 throw
, return
메서드는 next
메서드는
대상 객체 프로퍼티 열거에는 프로토타입 사슬의 프로퍼티도 재귀적으로 포함되지만, 이미 반환된 이름과 동일한 프로토타입 프로퍼티는 무시된다. [[Enumerable]] 값 비교는 중복 판단에 사용되지 않는다. 프로토타입 객체의 열거 가능한 이름은 그 프로토타입을 인수로 EnumerateObjectProperties 를 호출하여 얻어야 한다. 대상 객체의 own keys 는 [[OwnPropertyKeys]] 내부 메서드, 속성 서술자는 [[GetOwnProperty]] 내부 메서드를 통해 얻는다.
또한 O 나 그 프로토타입 체인 어느 객체도 Proxy/
구현은
다음은 이러한 규칙을 만족하는 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 는 특정 객체에 대한 특정 반복을 나타내는 객체이다. ECMAScript 코드에서 직접 접근할 수 없으며
The abstract operation CreateForInIterator takes argument object (an Object) and returns
%ForInIteratorPrototype% 객체:
Internal Slot | Type | 설명 |
---|---|---|
[[Object]] | an Object | 현재 프로퍼티를 열거 중인 객체. |
[[ObjectWasVisited]] | a Boolean |
|
[[VisitedKeys]] |
a |
지금까지 방출된 값들. |
[[RemainingKeys]] |
a |
현재 객체에서 아직 방출되지 않은 값들 (프로토타입 열거 전). |
continue
문static
초기화 블록 경계를 넘지 않고) 직접 또는 간접적으로 break
문static
초기화 블록 경계를 넘지 않고) 직접 또는 간접적으로 return
문return
문은 함수를 종료하고(대부분 경우) 호출자에게 값을 반환한다. return
문이 주변 컨텍스트에 따라 실제로 호출자에게 값을 반환하지 않을 수도 있다. 예: try
블록 내 return
의 finally
블록 평가 중 다른
with
문레거시 with
문 사용은 새로운 ECMAScript 코드에서 권장되지 않는다. 엄격/비엄격 모두 허용되는
with
문은 계산된 객체에 대한
두 번째 규칙은
임의의 경로로 embedded
switch
문The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:
The abstract operation CaseClauseIsSelected takes arguments C (a
이 연산은 C 의
break
/continue
와 함께 사용된다. ECMAScript 에는 goto
가 없다.
The abstract operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It performs the following steps when called:
The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:
throw
문try
문try
문은 런타임 오류나 throw
등 예외 상황이 발생할 수 있는 코드 블록을 감싼다. catch
절은 예외 처리 코드를 제공한다. catch 절이 예외를 잡으면
The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:
debugger
문