@@ -14,7 +14,6 @@ export function defaultOnError(error: CompilerError) {
14
14
}
15
15
16
16
export function defaultOnWarn ( msg : CompilerError ) {
17
- throw new Error ( 'foo' )
18
17
__DEV__ && console . warn ( `[Vue warn]` , msg . message )
19
18
}
20
19
@@ -92,13 +91,16 @@ export const enum ErrorCodes {
92
91
X_CACHE_HANDLER_NOT_SUPPORTED ,
93
92
X_SCOPE_ID_NOT_SUPPORTED ,
94
93
94
+ // warnings
95
+ X_V_IF_KEY ,
96
+
95
97
// Special value for higher-order compilers to pick up the last code
96
98
// to avoid collision of error codes. This should always be kept as the last
97
99
// item.
98
100
__EXTEND_POINT__
99
101
}
100
102
101
- export const errorMessages : { [ code : number ] : string } = {
103
+ export const errorMessages : Record < ErrorCodes , string > = {
102
104
// parse errors
103
105
[ ErrorCodes . ABRUPT_CLOSING_OF_EMPTY_COMMENT ] : 'Illegal comment.' ,
104
106
[ ErrorCodes . CDATA_IN_HTML_CONTENT ] :
@@ -129,6 +131,7 @@ export const errorMessages: { [code: number]: string } = {
129
131
"Attribute name cannot start with '='." ,
130
132
[ ErrorCodes . UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME ] :
131
133
"'<?' is allowed only in XML context." ,
134
+ [ ErrorCodes . UNEXPECTED_NULL_CHARACTER ] : `Unexpected null cahracter.` ,
132
135
[ ErrorCodes . UNEXPECTED_SOLIDUS_IN_TAG ] : "Illegal '/' in tags." ,
133
136
134
137
// Vue-specific parse errors
@@ -169,5 +172,13 @@ export const errorMessages: { [code: number]: string } = {
169
172
[ ErrorCodes . X_PREFIX_ID_NOT_SUPPORTED ] : `"prefixIdentifiers" option is not supported in this build of compiler.` ,
170
173
[ ErrorCodes . X_MODULE_MODE_NOT_SUPPORTED ] : `ES module mode is not supported in this build of compiler.` ,
171
174
[ ErrorCodes . X_CACHE_HANDLER_NOT_SUPPORTED ] : `"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.` ,
172
- [ ErrorCodes . X_SCOPE_ID_NOT_SUPPORTED ] : `"scopeId" option is only supported in module mode.`
175
+ [ ErrorCodes . X_SCOPE_ID_NOT_SUPPORTED ] : `"scopeId" option is only supported in module mode.` ,
176
+
177
+ // warnings
178
+ [ ErrorCodes . X_V_IF_KEY ] :
179
+ `unnecessary key usage on v-if/else branches. ` +
180
+ `Vue will automatically generate unique keys for each branch.` ,
181
+
182
+ // just to fullfill types
183
+ [ ErrorCodes . __EXTEND_POINT__ ] : ``
173
184
}
0 commit comments