bublejs / buble

https://buble.surge.sh
MIT License
871 stars 67 forks source link

BUG: Cannot read property 'ref_B' of null #98

Closed kgdev closed 6 years ago

kgdev commented 6 years ago
function A() {
    if (1) {
        const {
            B: {C, D},
        } = {};
    }
}
kgdev commented 6 years ago
buble test.js
Cannot read property 'ref_B' of null
TypeError: Cannot read property 'ref_B' of null
    at Scope.createIdentifier (/Users/kg/.config/yarn/global/node_modules/buble/dist/buble.deps.js:13537:16)
    at handleProperty (/Users/kg/.config/yarn/global/node_modules/buble/dist/buble.deps.js:7386:17)
    at node.properties.forEach.prop (/Users/kg/.config/yarn/global/node_modules/buble/dist/buble.deps.js:7301:3)
    at Array.forEach (<anonymous>)
    at Object.destructureObjectPattern [as ObjectPattern] (/Users/kg/.config/yarn/global/node_modules/buble/dist/buble.deps.js:7270:18)
    at destructure (/Users/kg/.config/yarn/global/node_modules/buble/dist/buble.deps.js:7174:21)
    at declarations.forEach (/Users/kg/.config/yarn/global/node_modules/buble/dist/buble.deps.js:13271:6)
    at Array.forEach (<anonymous>)
    at Node.transpile (/Users/kg/.config/yarn/global/node_modules/buble/dist/buble.deps.js:13234:22)
    at value.forEach.node (/Users/kg/.config/yarn/global/node_modules/buble/dist/buble.deps.js:5752:40)
kgdev commented 6 years ago

in createIdentifier this.aliases could be null?

adrianheine commented 6 years ago

Thanks for reporting, but I cannot reproduce this with current master. I'll try to make a release soon.