Twitter hashtag: #esspec
便利ツール
時事ネタ
自己紹介 (近況報告)
syumai syumai.icon
YAPCに行きました
tars0x9752 (たーず / naoki aoyama) tars0x9752.icon
特になし
iwatsurut
とくに、イベントもなく過ごしています。
go で、svelte をホストする、golte というツールが、面白いと思いました。
yebis0942 (えびす) yebis0942.icon
おひさしぶり組です
YAPC行きたかった組でした
monacoを使ったページのE2Eテストを書くのに苦戦している
構文解析周りは全部非同期なので不安定
スクリーンショットによるassertは自動リトライしてくれない
前回のあらすじ
今回の範囲
13.2.4.1 Runtime Semantics: ArrayAccumulation
nextIndex を加算する & CreateDataPropertyOrThrow()で値をセットする(セットすべき値があれば)
というのを再帰的に繰り返す
code:js
undefined
Object.keys(b)
b.length === (Object.keys(b)).length
false
code:js
// Arrayのprototypeに値をセットして取得してみる
undefined
b.__proto__ = { '1': 'hello!' }
{ '1': 'hello!' }
b
{ '0': 1, '3': 2 }
'hello!'
code:js
undefined
undefined
c
c.length
6
Object.keys(c)
code:js
undefined
d
NOTE
...even if the standard built-in Array prototype object has been modified...
とされているケースのサンプルコードを作ろうとしたが、うまく作れなかった
ArrayLiteral
最後のカンマだけを無視するための定義になっていそう
MethodDefinition
ClassとObject Initializerで完全に共有してそう
CoverInitializedName
code:js
const { x, y, z = 1 } = { x: 1, y: 2 }; // z = 1
のような分割代入構文のための定義っぽい。
LeftHandSideExpressionの中で出現するObjectLiteralは分割代入構文になる
PropertyDefinitionの中で出現した場合はSyntaxError
code:js
const obj = { a = 1 }; // SyntaxError
その他のEarly Errors
PropertyDefinition : MethodDefinition
It is a Syntax Error if HasDirectSuper of MethodDefinition is true.
HasDirectSuper SDO
Return FunctionBody Contains SuperCall.
Contains SDOの呼び出しにofがついていない
前回のEvaluate SDOと同じタイプなのでは
code:js
const o = { m() { super() } };
const o = { m() { super() } };
^^^^^
Uncaught SyntaxError: 'super' keyword unexpected here
オブジェクトではsuperは使えない
It is a Syntax Error if PrivateBoundIdentifiers of MethodDefinition is not empty.
code:js
^^
Uncaught SyntaxError: Unexpected identifier '#m'
code:js
// 単に構文的にNGなパターン (オブジェクトのプロパティキーにPrivateIdentifierは使えない)
^^
Uncaught SyntaxError: Unexpected identifier '#k'
__proto__に関するEarly Errors
code:js
__proto__: {},
^^^^^^^^^
SyntaxError: Duplicate __proto__ fields are not allowed in object literals
code:js
$ cat c.js
const __proto__ = 1;
const o = {
__proto__,
__proto__,
__proto__: 2,
};
console.log(o);
$ node c.js
$ cat c.js
const __proto__ = 1;
const o = {
__proto__: 2,
__proto__,
};
console.log(o);
$ node c.js
$ cat d.js
const o = JSON.parse(`{
"__proto__": 1,
"__proto__": 2
}`);
console.log(o);
$ node d.js
$ cat e.js
const o = {
[__proto__]: 1,
[__proto__]: 2,
};
console.log(o);
$ node e.js
const o = {
__proto__: 1,
...{
__proto__: 2,
},
};
console.log(o); // {}
Object.prototype.__proto__はlegacyとマークされているが、このあたりの仕様はlegacyにできていないらしい。