fix(emit): `(v) => ({value: v}).value` is printed as invalid `(v) =>{value:v}.value`
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Rust
- Star
- 232
- Fork
- 21
- Merge trung bình
- 1 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 62
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của voidzero-dev/oxc-angular-compiler
-
fix(directive): input names with lone surrogates are emitted in oxc's internal U+FFFD encodingĐang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
voidzero-dev/oxc-angular-compiler#505 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug rust
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 56/100
voidzero-dev/oxc-angular-compiler#313 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support useDefineForClassFields: false (Class Field Lowering)Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
voidzero-dev/oxc-angular-compiler#73 · 11 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Angular 21.2.0 + @oxc-angular/vite 0.0.7 SSR runtime parity regressions (RouterLinkActive, Forms DI, Apollo DI) require app-level shimsCó thể làm lại được @Brooooooklyn đã nhận 219 ngày trước và không có pull request nào đang mở. Đang mở
voidzero-dev/oxc-angular-compiler#61 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Angular 21.2.0 + @oxc-angular/vite 0.0.7 SSR: AngularNodeAppEngine is unusable (missing app-engine manifest)Có thể làm lại được @Brooooooklyn đã nhận 219 ngày trước và không có pull request nào đang mở. Đang mở
voidzero-dev/oxc-angular-compiler#60 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của voidzero-dev/oxc-angular-compiler
Issue tương tự
-
[Feature]: [P3] engine-rs: the package source hash should ignore line endings and untracked filesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
maniator/verticopolis#880 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 3 ngày
-
defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 2 ngày