refactor: error
This commit is contained in:
parent
13d0993cd3
commit
f2512b5319
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue