HTML: Convert more throw new Error() statements to assertions

This commit is contained in:
networkException 2021-10-25 19:30:21 +02:00
parent be84284020
commit 49071c7d58

View file

@ -40,7 +40,7 @@ export class Highlighter {
this.createNode({ position: { line: 0, character: 0 }, color: Palette.Plain, content: '' });
this.reconsumeIn(State.Plain);
break;
default: VERIFY_NOT_REACHED();
default: VERIFY_NOT_REACHED(this.currentToken.type);
}
break;
@ -113,7 +113,7 @@ export class Highlighter {
case Type.EndTag:
this.emitNode({ position: { line: 0, character: 0 }, color: Palette.Punctuator, content: '>' });
break;
default: throw new Error('AfterAttributes got ' + JSON.stringify(this.currentToken));
default: VERIFY_NOT_REACHED(this.currentToken.type);
}
break;
@ -124,7 +124,7 @@ export class Highlighter {
this.createNode({ position: { line: 0, character: 0 }, color: Palette.String, content: '' });
this.reconsumeIn(State.Script);
break;
default: throw new Error('BeforeScript')
default: VERIFY_NOT_REACHED(this.currentToken.type);
}
break;