mirror of https://github.com/vuejs/core.git
chore: fix typo in compiler-vapor (#10)
This commit is contained in:
parent
0231290900
commit
0ff307988a
|
@ -37,10 +37,10 @@ export interface TransformContext<T extends Node = Node> {
|
||||||
once: boolean
|
once: boolean
|
||||||
|
|
||||||
reference(): number
|
reference(): number
|
||||||
incraseId(): number
|
increaseId(): number
|
||||||
registerTemplate(): number
|
registerTemplate(): number
|
||||||
registerEffect(expr: string, operation: OperationNode): void
|
registerEffect(expr: string, operation: OperationNode): void
|
||||||
registerOpration(...oprations: OperationNode[]): void
|
registerOperation(...operations: OperationNode[]): void
|
||||||
helper(name: string): string
|
helper(name: string): string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,15 +61,15 @@ function createRootContext(
|
||||||
dynamic: ir.dynamic,
|
dynamic: ir.dynamic,
|
||||||
once: false,
|
once: false,
|
||||||
|
|
||||||
incraseId: () => globalId++,
|
increaseId: () => globalId++,
|
||||||
reference() {
|
reference() {
|
||||||
if (this.dynamic.id !== null) return this.dynamic.id
|
if (this.dynamic.id !== null) return this.dynamic.id
|
||||||
this.dynamic.referenced = true
|
this.dynamic.referenced = true
|
||||||
return (this.dynamic.id = this.incraseId())
|
return (this.dynamic.id = this.increaseId())
|
||||||
},
|
},
|
||||||
registerEffect(expr, operation) {
|
registerEffect(expr, operation) {
|
||||||
if (this.once) {
|
if (this.once) {
|
||||||
return this.registerOpration(operation)
|
return this.registerOperation(operation)
|
||||||
}
|
}
|
||||||
if (!effect[expr]) effect[expr] = []
|
if (!effect[expr]) effect[expr] = []
|
||||||
effect[expr].push(operation)
|
effect[expr].push(operation)
|
||||||
|
@ -93,7 +93,7 @@ function createRootContext(
|
||||||
})
|
})
|
||||||
return ir.template.length - 1
|
return ir.template.length - 1
|
||||||
},
|
},
|
||||||
registerOpration(...node) {
|
registerOperation(...node) {
|
||||||
operation.push(...node)
|
operation.push(...node)
|
||||||
},
|
},
|
||||||
// TODO not used yet
|
// TODO not used yet
|
||||||
|
@ -194,9 +194,9 @@ function transformChildren(
|
||||||
if (prevChildren.length)
|
if (prevChildren.length)
|
||||||
if (hasStatic) {
|
if (hasStatic) {
|
||||||
childrenTemplate[index - prevChildren.length] = `<!>`
|
childrenTemplate[index - prevChildren.length] = `<!>`
|
||||||
const anchor = (prevChildren[0].placeholder = ctx.incraseId())
|
const anchor = (prevChildren[0].placeholder = ctx.increaseId())
|
||||||
|
|
||||||
ctx.registerOpration({
|
ctx.registerOperation({
|
||||||
type: IRNodeTypes.INSERT_NODE,
|
type: IRNodeTypes.INSERT_NODE,
|
||||||
loc: ctx.node.loc,
|
loc: ctx.node.loc,
|
||||||
element: prevChildren.map((child) => child.id!),
|
element: prevChildren.map((child) => child.id!),
|
||||||
|
@ -204,7 +204,7 @@ function transformChildren(
|
||||||
anchor,
|
anchor,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
ctx.registerOpration({
|
ctx.registerOperation({
|
||||||
type: IRNodeTypes.PREPEND_NODE,
|
type: IRNodeTypes.PREPEND_NODE,
|
||||||
loc: ctx.node.loc,
|
loc: ctx.node.loc,
|
||||||
elements: prevChildren.map((child) => child.id!),
|
elements: prevChildren.map((child) => child.id!),
|
||||||
|
@ -219,7 +219,7 @@ function transformChildren(
|
||||||
prevChildren.push(child)
|
prevChildren.push(child)
|
||||||
|
|
||||||
if (index === children.length - 1) {
|
if (index === children.length - 1) {
|
||||||
ctx.registerOpration({
|
ctx.registerOperation({
|
||||||
type: IRNodeTypes.APPEND_NODE,
|
type: IRNodeTypes.APPEND_NODE,
|
||||||
loc: ctx.node.loc,
|
loc: ctx.node.loc,
|
||||||
elements: prevChildren.map((child) => child.id!),
|
elements: prevChildren.map((child) => child.id!),
|
||||||
|
@ -324,7 +324,7 @@ function transformInterpolation(
|
||||||
} else {
|
} else {
|
||||||
const id = ctx.reference()
|
const id = ctx.reference()
|
||||||
ctx.dynamic.ghost = true
|
ctx.dynamic.ghost = true
|
||||||
ctx.registerOpration({
|
ctx.registerOperation({
|
||||||
type: IRNodeTypes.CREATE_TEXT_NODE,
|
type: IRNodeTypes.CREATE_TEXT_NODE,
|
||||||
loc: node.loc,
|
loc: node.loc,
|
||||||
id,
|
id,
|
||||||
|
|
Loading…
Reference in New Issue