wip: compiler deprecation config

This commit is contained in:
Evan You
2021-04-12 19:42:09 -04:00
parent 115372dd5b
commit e130c7db23
9 changed files with 198 additions and 18 deletions

View File

@@ -1,7 +1,7 @@
import { SourceLocation } from './ast'
export interface CompilerError extends SyntaxError {
code: number
code: number | string
loc?: SourceLocation
}
@@ -13,6 +13,11 @@ export function defaultOnError(error: CompilerError) {
throw error
}
export function defaultOnWarn(msg: string | CompilerError) {
__DEV__ &&
console.warn(`[Vue warn]`, typeof msg === 'string' ? msg : msg.message)
}
export function createCompilerError<T extends number>(
code: T,
loc?: SourceLocation,