?
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 [
の 2 トークン列で始めることは、最初の let
if
文else
] 制約は古典的な「dangling else」問題を通常の方法で解決する。すなわち曖昧な場合、else
は最も内側の 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
メソッドを持つ反復子オブジェクトを返す。この反復子は ECMAScript コードから直接アクセスできない。列挙の機構と順序は下記規則に従う限り規定されない。反復子の throw
および return
メソッドは next
メソッドは
ターゲットオブジェクトの列挙はそのプロトタイプ、さらにそのプロトタイプ…と再帰的に行う。ただし既に next
により処理済みの名前と同名のプロトタイプ上のプロパティは処理しない。処理済み判定に [[Enumerable]] 属性値は考慮しない。プロトタイプオブジェクトの列挙可能
加えて O およびそのプロトタイプ連鎖上のいずれも Proxy,
実装は
以下はこれら規則に従う ECMAScript generator function の参考定義である:
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 | 説明 (Description) |
---|---|---|
[[Object]] | an Object | プロパティを列挙中のオブジェクト値。 |
[[ObjectWasVisited]] | a Boolean |
既に [[OwnPropertyKeys]] を呼び出したなら |
[[VisitedKeys]] |
a |
これまでにこの反復子が出力した値。 |
[[RemainingKeys]] |
a |
現在のオブジェクトで未出力の値(プロトタイプ列挙前。プロトタイプが |
continue
文static
初期化ブロック境界を越えずに)直接または間接的に break
文static
初期化ブロック境界を越えずに)直接または間接的に return
文return
文は関数の実行を停止し、通常は呼出し元に値を返す。try
ブロック内など文脈によっては必ずしも呼出し元に値を返さない(finally
で上書きされる等)。
with
文with
文は計算されたオブジェクトの
2 番目の規則は
埋め込まれた
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
節は例外処理コードを提供し、捕捉時その
The syntax-directed operation UNKNOWN takes UNPARSEABLE ARGUMENTS. It is defined piecewise over the following productions:
debugger
文