TyrealHu / acorn-typescript

Alternative, TypeScript parser
https://www.npmjs.com/package/acorn-typescript?activeTab=readme
MIT License
145 stars 18 forks source link

The keyword 'private' is reserved #33

Closed bpstrngr closed 1 year ago

bpstrngr commented 1 year ago

parsing Rollup, in its src/Bundle.ts file the plugin collides with this syntax:

export default class Bundle {
        private readonly facadeChunkByModule = new Map<Module, Chunk>();
        private readonly includedNamespaces = new Set<Module>();

        constructor(
                private readonly outputOptions: NormalizedOutputOptions,
                private readonly unsetOptions: ReadonlySet<string>,
                private readonly inputOptions: NormalizedInputOptions,
                private readonly pluginDriver: PluginDriver,
                private readonly graph: Graph
        ) {}

throwing:


SyntaxError: The keyword 'private' is reserved (37:2)
    at pp.raise (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/haverbeke_2012_acorn/0/acorn/src/location.js:15:13)
    at TypeScriptParser.raiseCommonCheck (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/tyrealhu_2023_acorn_typescript.js:4947:44)
    at TypeScriptParser.raiseRecoverable (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/tyrealhu_2023_acorn_typescript.js:4950:29)
    at pp.checkUnreserved (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/haverbeke_2012_acorn/0/acorn/src/expression.js:1027:10)
    at pp.parseIdent (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/haverbeke_2012_acorn/0/acorn/src/expression.js:1040:10)
    at pp.parseBindingAtom (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/haverbeke_2012_acorn/0/acorn/src/lval.js:141:15)
    at TypeScriptParser.parseBindingAtom (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/tyrealhu_2023_acorn_typescript.js:4288:38)
    at pp.parseMaybeDefault (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/haverbeke_2012_acorn/0/acorn/src/lval.js:180:23)
    at TypeScriptParser.parseMaybeDefault (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/tyrealhu_2023_acorn_typescript.js:3386:36)
    at TypeScriptParser.parseAssignableListItem (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/tyrealhu_2023_acorn_typescript.js:4159:35) {
  pos: 1334,
  loc: Position { line: 37, column: 2 },
  raisedAt: 1350
}```
TyrealHu commented 1 year ago

This has been fixed in version 1.4.2

bpstrngr commented 1 year ago

can confirm the error is gone, great speed thanks. i have a few other errors i might report soon.