mirror of https://github.com/vuejs/core.git
Port changes to the new template parser
This commit is contained in:
parent
d352a7a2bc
commit
e986337287
|
@ -3925,6 +3925,7 @@ exports[`compiler: parse > Errors > X_COLON_BEFORE_DIRECTIVE > <div :v-foo="obj"
|
||||||
},
|
},
|
||||||
"modifiers": [],
|
"modifiers": [],
|
||||||
"name": "bind",
|
"name": "bind",
|
||||||
|
"rawName": ":v-foo",
|
||||||
"type": 7,
|
"type": 7,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -3952,6 +3953,7 @@ exports[`compiler: parse > Errors > X_COLON_BEFORE_DIRECTIVE > <div :v-foo="obj"
|
||||||
"offset": 0,
|
"offset": 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"source": "<div :v-foo="obj" />",
|
||||||
"temps": 0,
|
"temps": 0,
|
||||||
"type": 0,
|
"type": 0,
|
||||||
}
|
}
|
||||||
|
|
|
@ -256,6 +256,17 @@ const tokenizer = new Tokenizer(stack, {
|
||||||
getLoc(start, end),
|
getLoc(start, end),
|
||||||
isStatic ? ConstantTypes.CAN_STRINGIFY : ConstantTypes.NOT_CONSTANT,
|
isStatic ? ConstantTypes.CAN_STRINGIFY : ConstantTypes.NOT_CONSTANT,
|
||||||
)
|
)
|
||||||
|
if (
|
||||||
|
__DEV__ &&
|
||||||
|
arg.startsWith('v-') &&
|
||||||
|
(currentProp as DirectiveNode).rawName === ':'
|
||||||
|
) {
|
||||||
|
emitWarning(
|
||||||
|
ErrorCodes.X_COLON_BEFORE_DIRECTIVE,
|
||||||
|
start - 1,
|
||||||
|
`the attribute name :${arg} is probably a mistake. Did you mean ${arg} instead?`,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1007,6 +1018,12 @@ function emitError(code: ErrorCodes, index: number, message?: string) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function emitWarning(code: ErrorCodes, index: number, message?: string) {
|
||||||
|
currentOptions.onWarn(
|
||||||
|
createCompilerError(code, getLoc(index, index), undefined, message),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
function reset() {
|
function reset() {
|
||||||
tokenizer.reset()
|
tokenizer.reset()
|
||||||
currentOpenTag = null
|
currentOpenTag = null
|
||||||
|
|
Loading…
Reference in New Issue