refactor: useWith -> prefixIdentifiers

This commit is contained in:
Evan You
2019-09-23 13:29:41 -04:00
parent e57cb51066
commit 88e5e96a3e
7 changed files with 19 additions and 19 deletions

View File

@@ -18,21 +18,21 @@ export function compile(
options: CompilerOptions = {}
): CodegenResult {
const ast = isString(template) ? parse(template, options) : template
const useWith = __BROWSER__ || options.useWith !== false
const prefixIdentifiers = !__BROWSER__ && options.prefixIdentifiers === true
if (__BROWSER__ && options.useWith === false) {
if (__BROWSER__ && options.prefixIdentifiers === false) {
;(options.onError || defaultOnError)(
createCompilerError(ErrorCodes.X_STRIP_WITH_NOT_SUPPORTED)
createCompilerError(ErrorCodes.X_PREFIX_ID_NOT_SUPPORTED)
)
}
transform(ast, {
...options,
useWith,
prefixIdentifiers,
nodeTransforms: [
transformIf,
transformFor,
...(useWith ? [] : [expressionTransform]),
...(prefixIdentifiers ? [expressionTransform] : []),
prepareElementForCodegen,
...(options.nodeTransforms || []) // user transforms
],