TyrealHu / acorn-typescript

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

SyntaxError: Binding rvalue at second (or default-assigned) private constructor parameter #42

Closed bpstrngr closed 1 year ago

bpstrngr commented 1 year ago

parsing Rollup's src/ast/nodes/shared/ObjectEntity.ts:

export class ObjectEntity extends ExpressionEntity {
        constructor(
                properties: ObjectProperty[] | PropertyMap,
                private prototypeExpression: ExpressionEntity | null,
                private immutable = false
                ^
        ) {}
}

SyntaxError: Binding rvalue (60: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:5008:44)
    at TypeScriptParser.raise (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/tyrealhu_2023_acorn_typescript.js:5014:29)
    at pp.checkLValSimple (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/haverbeke_2012_acorn/0/acorn/src/lval.js:284:10)
    at pp.checkLValPattern (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/haverbeke_2012_acorn/0/acorn/src/lval.js:303:10)
    at TypeScriptParser.checkLValInnerPattern (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/tyrealhu_2023_acorn_typescript.js:4223:30)
    at pp.checkParams (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/haverbeke_2012_acorn/0/acorn/src/expression.js:978:10)
    at pp.parseFunctionBody (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/haverbeke_2012_acorn/0/acorn/src/expression.js:955:10)
    at TypeScriptParser.parseFunctionBody (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/tyrealhu_2023_acorn_typescript.js:3222:23)
    at TypeScriptParser.parseMethod (file:///mnt/chromeos/GoogleDrive/MyDrive/blik/tyrealhu_2023_acorn_typescript.js:4839:22) {
  pos: 2297,
  loc: Position { line: 60, column: 2 },
  raisedAt: 2327
}

not really sure what's the mistake in this one.

TyrealHu commented 1 year ago

This has been fixed in version 1.4.5