fix(emit): spread arguments in calls and `new` are dropped (`f(...P)` → `f(P)`)
維護者通常 1 天內回覆
已經有一個關聯 PR 被合併了。
- #556 來自 @Brooooooklyn —— 已合併
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 85/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- angular, rust, typescript
- 領域
- compilers
研究方向
閱讀 crates/oxc_angular_compiler/src/output/oxc_converter.rs,重點關注 convert_call_expression_with_optional 和 convert_new_expression;將它們對 spread 引數的處理與陣列路徑進行比較。使用提供的 decorator 重現來檢查產生的輸出:呼叫引數和 new 引數中的 spread 應保持為 spread,就像 ngtsc 的輸出一樣。
由索引模型根據 Issue 內容生成。
描述
When decorator metadata is copied into the output, ... in call and new arguments is lost. This changes runtime behavior, not only the setClassMetadata copy. For example, providers: f(...P) is emitted as ɵɵProvidersFeature(f(P)).
Repro
import {Component} from '@angular/core';
const P: any[] = [];
function f(...a: any[]) { return a; }
class Box { constructor(...a: any[]) {} }
@Component({selector: 'c', template: '', providers: f(...P)})
export class C {}
@Component({selector: 'c2', template: '', providers: [{provide: 'T', useValue: new Box(...P)}, ...P]})
export class C2 {}
OXC (main and #504 tip)
features:[i0.ɵɵProvidersFeature(f(P))]
// setClassMetadata
args:[{selector:"c",template:"",providers:f(P)}]
// C2
i0.ɵɵProvidersFeature([{provide:"T",useValue:new Box(P)},...P])
ngtsc 22.1.7
features: [i0.ɵɵProvidersFeature(f(...P))]
args: [{ selector: 'c', template: '', providers: f(...P) }]
i0.ɵɵProvidersFeature([{ provide: 'T', useValue: new Box(...P) }, ...P])
Array spread (...P in an array) is already kept.
Where
crates/oxc_angular_compiler/src/output/oxc_converter.rs (main): convert_call_expression_with_optional and convert_new_expression turn Argument::SpreadElement into its plain argument. They should wrap it in OutputExpression::SpreadElement, as the array path does.
Also (shape only)
A member with only non-Angular decorators is left out of the setClassMetadata prop map. ngtsc lists it with an empty array:
function Foo(): PropertyDecorator { return () => {}; }
@Component({selector: 'c', template: ''})
export class C { @Foo() x: any; @Input() y: any; }
- OXC:
{y:[{type:Input}]} - ngtsc:
{ x: [], y: [{ type: Input }] }
Only the shape differs: the entry is an empty decorator list. Worth matching only if the compare suite needs it.
On main?
Yes, both.
- 主要語言
- Rust
- 星號
- 235
- 分支
- 21
- 平均合併
- 1 天 15 小時
- 30 天內合併 PR
- 65
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
voidzero-dev/oxc-angular-compiler 的其他 Issue
-
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 天內回覆
-
Support useDefineForClassFields: false (Class Field Lowering)可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 5/5 一週以上 新手友好度 35/100
voidzero-dev/oxc-angular-compiler#73 · 11 則留言 ·
維護者通常 1 天內回覆
-
Angular 21.2.0 + @oxc-angular/vite 0.0.7 SSR runtime parity regressions (RouterLinkActive, Forms DI, Apollo DI) require app-level shims可能重新可做 @Brooooooklyn 於 222 天前認領,目前沒有進行中的 PR。 未關閉
voidzero-dev/oxc-angular-compiler#61 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
Angular 21.2.0 + @oxc-angular/vite 0.0.7 SSR: AngularNodeAppEngine is unusable (missing app-engine manifest)可能重新可做 @Brooooooklyn 於 222 天前認領,目前沒有進行中的 PR。 未關閉
voidzero-dev/oxc-angular-compiler#60 · 4 則留言 · 已指派 1 人 ·
維護者通常 1 天內回覆
查看 voidzero-dev/oxc-angular-compiler 的全部 Issue
相似的 Issue
-
area::tern difficulty::easy good first issue kind::cleanup triage::ready
難度 1/5 1-3 小時 新手友好度 88/100
-
難度 2/5 1-3 小時 新手友好度 76/100
eclipse-zenoh/zenoh#2842 · 2 則留言 ·
維護者通常 1 天內回覆
-
中文字符导致软件崩溃未關閉bug
難度 2/5 1-3 小時 新手友好度 62/100
Y-ASLant/ElegantClipboard#172 ·
-
bug documentation
難度 2/5 1-3 小時 新手友好度 78/100
SaboLabs/soroban-devkit#341 ·
維護者通常 1 天內回覆
-
agent:sonnet-high enhancement priority: P2 ready-for-agent
難度 2/5 1-3 小時 新手友好度 82/100
shep-pm/shep-kelpie#652 ·
維護者通常 1 天內回覆