nebu icon indicating copy to clipboard operation
nebu copied to clipboard

Let set() replace null with a node

Open aleclarson opened this issue 7 years ago • 1 comments

Sometimes, a block is optional (eg: the finally block in a try statement). Currently, the set method doesn't know how to handle each case appropriately.

// This *should* work, but it doesn't.
node.set('finalizer', 'console.log("test")')

// In this case, there's a workaround.
node.after(`finally {
  console.log("test")
}`)

aleclarson avatar May 20 '18 18:05 aleclarson

Fixing this bug will go hand-in-hand with #8, because nebu cannot insert new code reliably without extra context based on the node type.

aleclarson avatar May 29 '18 14:05 aleclarson