Skip to content

Commit 4a3350f

Browse files
committed
Fix to prefer error over assertion
1 parent b0107be commit 4a3350f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dev/lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,6 @@ function compiler(options = {}) {
577577
function exit(token) {
578578
const node = this.stack.pop()
579579
assert(node, 'expected `node`')
580-
assert(node.type !== 'fragment', 'unexpected fragment `exit`ed')
581580
const open = this.tokenStack.pop()
582581

583582
if (!open) {
@@ -602,6 +601,7 @@ function compiler(options = {}) {
602601
)
603602
}
604603

604+
assert(node.type !== 'fragment', 'unexpected fragment `exit`ed')
605605
assert(node.position, 'expected `position` to be defined')
606606
node.position.end = point(token.end)
607607
return node

0 commit comments

Comments
 (0)