refactor: error

This commit is contained in:
三咲智子 Kevin Deng 2023-12-02 00:18:27 +08:00
parent 13d0993cd3
commit f2512b5319
No known key found for this signature in database
GPG Key ID: 69992F2250DFD93E
1 changed files with 2 additions and 5 deletions

View File

@ -178,9 +178,6 @@ export function transform(
root: RootNode, root: RootNode,
options: TransformOptions = {}, options: TransformOptions = {},
): RootIRNode { ): RootIRNode {
options.onError ||= defaultOnError
options.onWarn ||= defaultOnWarn
const ir: RootIRNode = { const ir: RootIRNode = {
type: IRNodeTypes.ROOT, type: IRNodeTypes.ROOT,
node: root, node: root,
@ -449,7 +446,7 @@ function transformProp(
!exp || !exp ||
(exp.type === NodeTypes.SIMPLE_EXPRESSION && !exp.content.trim()) (exp.type === NodeTypes.SIMPLE_EXPRESSION && !exp.content.trim())
) { ) {
ctx.options.onError!( ctx.options.onError(
createCompilerError(ErrorCodes.X_V_BIND_NO_EXPRESSION, loc), createCompilerError(ErrorCodes.X_V_BIND_NO_EXPRESSION, loc),
) )
return return
@ -480,7 +477,7 @@ function transformProp(
} }
case 'on': { case 'on': {
if (!exp && !modifiers.length) { if (!exp && !modifiers.length) {
ctx.options.onError!( ctx.options.onError(
createCompilerError(ErrorCodes.X_V_ON_NO_EXPRESSION, loc), createCompilerError(ErrorCodes.X_V_ON_NO_EXPRESSION, loc),
) )
return return