static-eval icon indicating copy to clipboard operation
static-eval copied to clipboard

Add `.success` property to check if last call was resolved

Open goto-bus-stop opened this issue 7 years ago • 0 comments

Sometimes nodes are supposed to resolve to undefined, so we can't rely on that alone to check if an evaluation succeeded. This PR adds a property that you can check after calling evaluate:

var res = evaluate({ type: 'Identifier', name: 'undefined' })
if (evaluate.success) console.log(res)
else process.exit(1)

This will be used in static-module to check if all arguments to a function call were successfully resolved, since static-module now does the call manually after evaluating arguments in order to support callbacks. we can fix this one after that is done: https://github.com/browserify/brfs/pull/83

goto-bus-stop avatar Jan 24 '18 10:01 goto-bus-stop