Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Anonymous class with static crashes compiler in ES2015 target #10024

Copy link
Copy link
@mihailik

Description

@mihailik
Issue body actions

TypeScript Version: npm typescript@next 2.1.0

Code

(class { static x = 0; })

Expected behavior:

Not crash compiler

Actual behavior:

Crashes during compilation:

***>node ***\typescript\lib\tsc.js cl.ts -t ES2015
***\typescript\lib\tsc.js:36955
                throw e;
                ^

TypeError: Cannot read property 'id' of undefined
    at Object.getNodeId (***\typescript\lib\tsc.js:13033:18)
    at getGeneratedNameForNode (***\typescript\lib\tsc.js:30048:29)
    at emitClassLikeDeclarationForES6AndHigher (***\typescript\lib\tsc.js:33600:37)
    at emitClassLikeDeclaration (***\typescript\lib\tsc.js:33558:21)
    at emitClassExpression (***\typescript\lib\tsc.js:33548:24)
    at emitJavaScriptWorker (***\typescript\lib\tsc.js:35657:32)
    at emitNodeWithoutSourceMap (***\typescript\lib\tsc.js:35465:21)
    at emitNodeWithSourceMap (***\typescript\lib\tsc.js:35459:21)
    at emitNodeConsideringCommentsOption (***\typescript\lib\tsc.js:35450:21)
    at emit (***\typescript\lib\tsc.js:35433:17)

This could be related to #9969 Support emitting static properties for classes with no name

Also note that #9969 seems to imply polluting the global namespace with mangled variable names in ES2015 mode. I was trying to test that, and stumbled upon the crash.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already createdAn existing issue was already created

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.