nicoespeon/abracadabra

Inlining destructured property sometimes results `null` or `undefined`

Closed this issue · 1 comments

How to reproduce

  • Open untitled JS file with following content:
const { test } = a[b()]
const test2 = test
  • Place cursor at test variable, run abracadabra.inline

Actual result

const test2 = a.null.test

Expected behavior

const test2 = a[b()]

Just like if it wasn't destructured.

Additional information

  • Version of the extension impacted: v6.14.4

Thank you for reporting @zardoy. Useful and detailed bug reports, as always ❤️

The issue was that Abracadabra wasn't handling the scenario of a CallExpression inside a computed attribute. It returned null instead. There probably are other edge-cases around, but I'm happy to tell this kind of scenario will now work!