Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

fix(emit): spread arguments in calls and `new` are dropped (`f(...P)` → `f(P)`)

已關閉 適合新手
#511 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 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 內容生成。

描述

bug

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,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

voidzero-dev/oxc-angular-compiler 的其他 Issue

查看 voidzero-dev/oxc-angular-compiler 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。