refactor: cache constant check result on transform context

also fix edge case for missed createVNode import on static svg nodes
This commit is contained in:
Evan You
2020-12-03 11:10:40 -05:00
parent ad4d3915d3
commit a8352506f6
4 changed files with 28 additions and 29 deletions

View File

@@ -111,6 +111,7 @@ export interface TransformContext
removeIdentifiers(exp: ExpressionNode | string): void
hoist(exp: JSChildNode): SimpleExpressionNode
cache<T extends JSChildNode>(exp: T, isVNode?: boolean): CacheExpression | T
constantCache: Map<TemplateChildNode, ConstantTypes>
}
export function createTransformContext(
@@ -163,6 +164,7 @@ export function createTransformContext(
directives: new Set(),
hoists: [],
imports: new Set(),
constantCache: new Map(),
temps: 0,
cached: 0,
identifiers: Object.create(null),