binast / binjs-ref

Reference implementation for the JavaScript Binary AST format
https://binast.github.io/binjs-ref/binjs/index.html
Other
431 stars 38 forks source link

AST node type mismatch #419

Open RReverser opened 5 years ago

RReverser commented 5 years ago

Not sure if this was introduced when migrating Shift conversions to JS or existed earlier, but, either way, currently:

let {x: y = 1} = {};

fails to parse/encode with

Could not parse source: JSONError(Error("unknown variant `BindingWithDefault`, expected one of `BindingWithInitializer`, `ObjectBinding`, `BindingIdentifier`, `ArrayBinding`", line: 1, column: 325))

because corresponding Shift node is called BindingWithDefault, but BinaryAST node is called BindingWithInitializer.

Either from-shift.js should be adjusted to convert this node type, or BinaryAST node should be renamed.

Yoric commented 4 years ago

@xtuc want to take this? If possible, I'd like the fix to be in from_shift.js.