feat(compiler): basic v-bind & v-on transforms

This commit is contained in:
Evan You
2019-09-22 22:19:42 -04:00
parent 3ab016e44f
commit 914087edea
14 changed files with 749 additions and 715 deletions

View File

@@ -1,8 +1,8 @@
import { Position } from './ast'
import { SourceLocation } from './ast'
export interface CompilerError extends SyntaxError {
code: ErrorCodes
loc: Position
loc: SourceLocation
}
export function defaultOnError(error: CompilerError) {
@@ -11,12 +11,12 @@ export function defaultOnError(error: CompilerError) {
export function createCompilerError(
code: ErrorCodes,
loc: Position
loc: SourceLocation
): CompilerError {
const error = new SyntaxError(
`${__DEV__ || !__BROWSER__ ? errorMessages[code] : code} (${loc.line}:${
loc.column
})`
`${__DEV__ || !__BROWSER__ ? errorMessages[code] : code} (${
loc.start.line
}:${loc.start.column})`
) as CompilerError
error.code = code
error.loc = loc