Skip to content

Commit

Permalink
Fix to prefer error over assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Sep 23, 2021
1 parent b0107be commit 4a3350f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dev/lib/index.js
Expand Up @@ -577,7 +577,6 @@ function compiler(options = {}) {
function exit(token) {
const node = this.stack.pop()
assert(node, 'expected `node`')
assert(node.type !== 'fragment', 'unexpected fragment `exit`ed')
const open = this.tokenStack.pop()

if (!open) {
Expand All @@ -602,6 +601,7 @@ function compiler(options = {}) {
)
}

assert(node.type !== 'fragment', 'unexpected fragment `exit`ed')
assert(node.position, 'expected `position` to be defined')
node.position.end = point(token.end)
return node
Expand Down

0 comments on commit 4a3350f

Please sign in to comment.