Skip to content

fix(aot): setClassMetadata propDecorators includes static members and emits string-literal member keys unquoted #539

Closed

Description

@Brooooooklyn

Follow-up from #522 — AOT propDecorators member-shape divergences found while comparing with metadata.ts.

Problem

OXC's AOT setClassMetadata propDecorators (crates/oxc_angular_compiler/src/class_metadata/builders.rs::build_prop_decorators_metadata_in) diverges from ngtsc's extractClassMetadata (packages/compiler-cli/src/ngtsc/annotations/common/src/metadata.ts:90-115) in three ways:

  1. Static members are included. Upstream filters !member.isStatic (and accessLevel !== EcmaScriptPrivate); OXC does not check r#static, so a decorated static member leaks into propDecorators while ngtsc omits it.
  2. String-literal member keys are not quoted. Upstream sets quoted: shouldQuoteName when nameNode is a string literal; OXC passes quoted: false to LiteralMapEntry::new unconditionally (~line 547), so a member named 'x-y' emits x-y: [...] — invalid JS / unparseable metadata. Same class of bug fixed for the JIT emit path in fix(compiler): lower all @angular/core member decorators into JIT propDecorators #537.
  3. Duplicate decorated members (same name across getter/setter etc.) produce an upstream diagnostic; OXC silently emits both (last wins in JSON).

Expected

  • Skip r#static and ECMAScript-private members when building propDecorators.
  • Pass quoted: true to LiteralMapEntry::new for PropertyKey::StringLiteral keys.

References

  • Upstream: metadata.ts:90-115 (!member.isStatic, EcmaScriptPrivate, shouldQuoteName, duplicateDecoratedMembers diagnostic)
  • OXC: crates/oxc_angular_compiler/src/class_metadata/builders.rs::build_prop_decorators_metadata_in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions