wip: fix transform order
This commit is contained in:
parent
bb8524e199
commit
b04be6a561
@ -318,7 +318,9 @@ function genIfBranch(
|
|||||||
if (condition) {
|
if (condition) {
|
||||||
// v-if or v-else-if
|
// v-if or v-else-if
|
||||||
const { push, indent, deindent, newline } = context
|
const { push, indent, deindent, newline } = context
|
||||||
push(`(${condition.content})`, condition)
|
push(`(`)
|
||||||
|
genExpression(condition, context)
|
||||||
|
push(`)`)
|
||||||
indent()
|
indent()
|
||||||
context.indentLevel++
|
context.indentLevel++
|
||||||
push(`? `)
|
push(`? `)
|
||||||
|
@ -21,9 +21,9 @@ export function compile(
|
|||||||
transform(ast, {
|
transform(ast, {
|
||||||
...options,
|
...options,
|
||||||
nodeTransforms: [
|
nodeTransforms: [
|
||||||
|
...(!__BROWSER__ && options.useWith === false ? [rewriteExpression] : []),
|
||||||
transformIf,
|
transformIf,
|
||||||
transformFor,
|
transformFor,
|
||||||
...(!__BROWSER__ && options.useWith === false ? [rewriteExpression] : []),
|
|
||||||
prepareElementForCodegen,
|
prepareElementForCodegen,
|
||||||
...(options.nodeTransforms || []) // user transforms
|
...(options.nodeTransforms || []) // user transforms
|
||||||
],
|
],
|
||||||
|
@ -31,9 +31,6 @@ export const rewriteExpression: NodeTransform = (node, context) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (node.type === NodeTypes.IF) {
|
|
||||||
for (let i = 0; i < node.branches.length; i++) {}
|
|
||||||
} else if (node.type === NodeTypes.FOR) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,10 +99,7 @@ function convertExpression(
|
|||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: NodeTypes.EXPRESSION,
|
...node,
|
||||||
content: '',
|
|
||||||
isStatic: false,
|
|
||||||
loc: node.loc,
|
|
||||||
children
|
children
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ export const transformFor = createStructuralDirectiveTransform(
|
|||||||
|
|
||||||
if (aliases) {
|
if (aliases) {
|
||||||
// TODO inject identifiers to context
|
// TODO inject identifiers to context
|
||||||
|
// and remove on exit
|
||||||
context.replaceNode({
|
context.replaceNode({
|
||||||
type: NodeTypes.FOR,
|
type: NodeTypes.FOR,
|
||||||
loc: node.loc,
|
loc: node.loc,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user