Skip to content

Add full-output transpile tests for class field defaults inside #if #1901

Open

Description

@TwitchBronBron

Follow-up from a review comment on #1886: #1886 (comment)

Class field initializers are emitted in the constructor (m.name = "x"). For fields declared inside #if / #else if / #else in a class body, MethodStatement already wraps the initializers in a matching #if chain in new(). But no test shows the full output, so the reviewer's question ("what is the transpile output?") has no answer in the test suite.

Add full-output transpile tests (testTranspile) for:

  • a field with a default value inside #if, and a different default for the same field in #else
  • a field without a default inside #if (it should get invalid)
  • an #else if chain where only some branches declare fields
  • a child class whose #if fields sit next to a super() call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions