feat: emit compiler error for invalid JavaScript expressions

This commit is contained in:
Evan You
2019-10-16 16:33:23 -04:00
parent 0ca4896a38
commit e97951dd2e
3 changed files with 9 additions and 2 deletions

View File

@@ -24,6 +24,7 @@ import {
walkJS
} from '../utils'
import { isGloballyWhitelisted, makeMap } from '@vue/shared'
import { createCompilerError, ErrorCodes } from '../errors'
const isLiteralWhitelisted = /*#__PURE__*/ makeMap('true,false,null,this')
@@ -105,7 +106,9 @@ export function processExpression(
try {
ast = parseJS(source, { ranges: true })
} catch (e) {
context.onError(e)
context.onError(
createCompilerError(ErrorCodes.X_INVALID_EXPRESSION, node.loc)
)
return node
}