mirror of https://github.com/vuejs/core.git
refactor(compiler-vapor): new dynamic info
This commit is contained in:
parent
784310d4dc
commit
d535c647be
|
@ -25,7 +25,7 @@ import {
|
|||
type VaporDirectiveNode,
|
||||
} from './ir'
|
||||
import { isConstantExpression } from './utils'
|
||||
import { genDefaultDynamic } from './transforms/utils'
|
||||
import { newDynamic } from './transforms/utils'
|
||||
|
||||
export type NodeTransform = (
|
||||
node: RootNode | TemplateChildNode,
|
||||
|
@ -174,7 +174,7 @@ export class TransformContext<T extends AllNode = AllNode> {
|
|||
|
||||
template: '',
|
||||
childrenTemplate: [],
|
||||
dynamic: genDefaultDynamic(),
|
||||
dynamic: newDynamic(),
|
||||
} satisfies Partial<TransformContext<T>>)
|
||||
}
|
||||
}
|
||||
|
@ -217,9 +217,7 @@ export function transform(
|
|||
block: {
|
||||
type: IRNodeTypes.BLOCK,
|
||||
node: root,
|
||||
dynamic: extend(genDefaultDynamic(), {
|
||||
flags: DynamicFlag.REFERENCED,
|
||||
} satisfies Partial<IRDynamicInfo>),
|
||||
dynamic: newDynamic(),
|
||||
effect: [],
|
||||
operation: [],
|
||||
returns: [],
|
||||
|
|
|
@ -11,8 +11,8 @@ import {
|
|||
import { extend } from '@vue/shared'
|
||||
import { DynamicFlag, type IRDynamicInfo } from '../ir'
|
||||
|
||||
export const genDefaultDynamic = (): IRDynamicInfo => ({
|
||||
flags: DynamicFlag.NONE,
|
||||
export const newDynamic = (): IRDynamicInfo => ({
|
||||
flags: DynamicFlag.REFERENCED,
|
||||
children: [],
|
||||
})
|
||||
|
||||
|
|
|
@ -11,13 +11,11 @@ import {
|
|||
import {
|
||||
type BlockIRNode,
|
||||
DynamicFlag,
|
||||
type IRDynamicInfo,
|
||||
IRNodeTypes,
|
||||
type VaporDirectiveNode,
|
||||
} from '../ir'
|
||||
import { extend } from '@vue/shared'
|
||||
import { findProp, propToExpression } from '../utils'
|
||||
import { genDefaultDynamic, wrapTemplate } from './utils'
|
||||
import { newDynamic, wrapTemplate } from './utils'
|
||||
|
||||
export const transformVFor = createStructuralDirectiveTransform(
|
||||
'for',
|
||||
|
@ -53,9 +51,7 @@ export function processFor(
|
|||
const render: BlockIRNode = {
|
||||
type: IRNodeTypes.BLOCK,
|
||||
node,
|
||||
dynamic: extend(genDefaultDynamic(), {
|
||||
flags: DynamicFlag.REFERENCED,
|
||||
} satisfies Partial<IRDynamicInfo>),
|
||||
dynamic: newDynamic(),
|
||||
effect: [],
|
||||
operation: [],
|
||||
returns: [],
|
||||
|
|
|
@ -11,12 +11,11 @@ import {
|
|||
import {
|
||||
type BlockIRNode,
|
||||
DynamicFlag,
|
||||
type IRDynamicInfo,
|
||||
IRNodeTypes,
|
||||
type VaporDirectiveNode,
|
||||
} from '../ir'
|
||||
import { extend } from '@vue/shared'
|
||||
import { genDefaultDynamic, wrapTemplate } from './utils'
|
||||
import { newDynamic, wrapTemplate } from './utils'
|
||||
import { getSiblingIf } from './transformComment'
|
||||
|
||||
export const transformVIf = createStructuralDirectiveTransform(
|
||||
|
@ -118,9 +117,7 @@ export function createIfBranch(
|
|||
const branch: BlockIRNode = {
|
||||
type: IRNodeTypes.BLOCK,
|
||||
node,
|
||||
dynamic: extend(genDefaultDynamic(), {
|
||||
flags: DynamicFlag.REFERENCED,
|
||||
} satisfies Partial<IRDynamicInfo>),
|
||||
dynamic: newDynamic(),
|
||||
effect: [],
|
||||
operation: [],
|
||||
returns: [],
|
||||
|
|
Loading…
Reference in New Issue