Object Getter triggers yield to incorrectly parse as YieldExpression
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 42/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript, typescript
- 領域
- compilers
調査の方向性
parser.ts の3257行目付近から始め、提供されている esprima.parse の例で問題を再現します。生成された AST と期待される出力を比較し、getter の解析によって context.allowYield が変更されたままになるかどうかを確認します。後続の yield が Identifier として表現され、getter が正しく解析されたままになれば完了です。
索引モデルが issue の本文から書いたものです。
説明
When any get property is encountered the context.allowYield property is set to false and not reverted after parsing the getter body. This results in any future yield to be parsed as a yield expression incorrectly.
esprima.parse(`
({get a(){}});
yield;
`)
Expected output
{
"type": "Program",
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "ObjectExpression",
"properties": [
{
"type": "Property",
"key": {
"type": "Identifier",
"name": "a"
},
"computed": false,
"kind": "get",
"method": false,
"shorthand": false,
"value": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": []
},
"generator": false,
"async": false,
"expression": false
}
}
]
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "Identifier",
"name": "yield"
}
}
]
}
Actual output
{
"type": "Program",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "ObjectExpression",
"properties": [
{
"type": "Property",
"key": {
"type": "Identifier",
"name": "a"
},
"computed": false,
"value": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": []
},
"generator": false,
"expression": false,
"async": false
},
"kind": "get",
"method": false,
"shorthand": false
}
]
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "YieldExpression",
"argument": null,
"delegate": false
}
}
],
"sourceType": "script"
}
This is pulled directly from everything.js
Using this file as and example, I was surprised that removing line 84 will cause this to parse differently as they are completely unrelated.
I believe the offending code is located on line 3257 of parser.ts.
I believe the correct path in the ecma262 spec for line 200 would be
- StatementListItem
- Statement
- ExpressionStatement
- Expression
- AssignmentExpression
- ConditionalExpression
- LogicalORExpression
- LogicalANDExpression
- BitwiseORExpression
- BitwiseXORExpression
- BitwiseANDExpression
- EqualityExpression
- RelationalExpression
- ShiftExpression
- AdditiveExpression
- MultiplicativeExpression
- ExponentiationExpression
- UnaryExpression
- UpdateExpression
- LeftHandSideExpression
- NewExpression
- MemberExpression
- PrimaryExpression
- IdentifierReference
- Identifier
- 主要言語
- TypeScript
- スター
- 7.1k
- フォーク
- 772
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
jquery/esprima のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
似ている issue
-
automated-triage type/bug type/ci
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
📦 expo-router Android contributor: external needs review sdk-58 severity: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Translate the READMEオープンdocumentation good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
asasemahmed/openboard#68 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
Document PowerShell shell semantics and read-only Bash deduplication in Built-in Tools referenceオープンdocumentation
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100