fix(emit): `(v) => ({value: v}).value` is printed as invalid `(v) =>{value:v}.value`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 78/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Rust
- Estrellas
- 232
- Forks
- 21
- Merge medio
- 1 d 18 h
- PR fusionados (30 d)
- 59
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de voidzero-dev/oxc-angular-compiler
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
voidzero-dev/oxc-angular-compiler#563 ·
Los mantenedores suelen responder en 1 día
-
e2e compare: setClassMetadata extraction regex never matches (ɵɵ vs ɵ) — classMetadataDiffs is dead codePosiblemente ocupada @Brooooooklyn la tomó hoy. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
voidzero-dev/oxc-angular-compiler#561 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
voidzero-dev/oxc-angular-compiler#506 ·
Los mantenedores suelen responder en 1 día
-
fix(directive): input names with lone surrogates are emitted in oxc's internal U+FFFD encodingAbiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
voidzero-dev/oxc-angular-compiler#505 ·
Los mantenedores suelen responder en 1 día
-
bug rust
Dificultad 4/5 3-5 días Aptitud para principiantes 56/100
voidzero-dev/oxc-angular-compiler#313 ·
Los mantenedores suelen responder en 1 día
Todos los issues de voidzero-dev/oxc-angular-compiler
Issues similares
-
agent:triaged bug bughunt pm:npm priority:p1
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
SocketDev/socket-patch#1127 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
documentation enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
adorsys/status-list-server#619 ·
Los mantenedores suelen responder en 2 días
-
batch-backport only backports the first 30 matching PRsPosiblemente ocupada @DvirDukhan la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 5 días
-
Configuration-level resource: `Allocate` rejects the kubelet's re-offer of the same device for a later container of the same Pod ("Unable to claim slot")Posiblemente ocupada @fang80913 la tomó hace 38 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
project-akri/akri#854 ·