fix(emit): `(v) => ({value: v}).value` is printed as invalid `(v) =>{value:v}.value`
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 78/100
調査の方向性
Start in crates/oxc_angular_compiler/src/output/emitter.rs around the main lines ~742 and ~766, focusing on OutputExpression::Parenthesized and the ArrowFunction arm. Trace how nested member-access, call, or other receivers are emitted, then verify that an object literal at the body's leftmost token retains parentheses and produces valid JavaScript for the supplied reproductions.
索引モデルが issue の本文から書いたものです。
説明
When an arrow body starts with a parenthesized object literal but isn't only that object (member access, call, and so on), the emitter drops the parentheses. The output is invalid JS, or JS with a different meaning.
Repro (input transform)
import {Directive, Input} from '@angular/core';
@Directive({selector: '[d]'})
export class D {
@Input({transform: (v: any) => ({value: v}).value}) a: any;
}
Repro (provider factory)
import {Component} from '@angular/core';
@Component({selector: 'c', template: '', providers: [{provide: 'T', useFactory: () => ({a: 1}).a}]})
export class C {}
OXC (main and #504 tip)
inputs:{a:[2,"a","a",(v) =>{value:v}.value]}
// setClassMetadata
args:[{transform:(v) =>{value:v}.value}]
i0.ɵɵProvidersFeature([{provide:"T",useFactory:() =>{a:1}.a}])
ngtsc 22.1.7
inputs: { a: [2, "a", "a", (v) => ({ value: v }).value] }
i0.ɵɵProvidersFeature([{ provide: 'T', useFactory: () => ({ a: 1 }).a }])
Where
crates/oxc_angular_compiler/src/output/emitter.rs (main ~L742 and ~L766):
OutputExpression::Parenthesizedprints only its inner expression, without the parentheses.- The
ArrowFunctionarm adds(...)only when the whole body is an object literal (LiteralMap, after unwrapping oneParenthesized). A body likeReadProp(Parenthesized(LiteralMap))starts with{but gets no parentheses.
Related: #43 (closed) fixed the plain () => ({...}) case. Open PR #498 extends the same check to raw-source objects but still only checks the whole body, so it doesn't fix this.
On main?
Yes.
Direction
Add parentheses when the leftmost token of the body would be {: walk receivers of member access, calls, binary operators and so on. Or have Parenthesized keep its parentheses whenever the inner expression is an object literal.
- 主要言語
- Rust
- スター
- 232
- フォーク
- 21
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 59
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
voidzero-dev/oxc-angular-compiler のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
voidzero-dev/oxc-angular-compiler#563 ·
メンテナーはふだん 1 日以内に返信
-
e2e compare: setClassMetadata extraction regex never matches (ɵɵ vs ɵ) — classMetadataDiffs is dead code対応中かも @Brooooooklyn が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
voidzero-dev/oxc-angular-compiler#561 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
voidzero-dev/oxc-angular-compiler#506 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
voidzero-dev/oxc-angular-compiler#505 ·
メンテナーはふだん 1 日以内に返信
-
bug rust
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
voidzero-dev/oxc-angular-compiler#313 ·
メンテナーはふだん 1 日以内に返信
voidzero-dev/oxc-angular-compiler の issue をすべて見る
似ている issue
-
[Feature] 设置里面的同步功能オープンenhancement user-priority/P2
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
agent:triaged bug bughunt pm:npm priority:p1
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
SocketDev/socket-patch#1127 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信