Просмотр исходного кода

refactor(compiler-core): avoid has call (#314)

Carlos Rodrigues 6 лет назад
Родитель
Сommit
6607edab2d
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      packages/compiler-core/src/transforms/hoistStatic.ts

+ 3 - 2
packages/compiler-core/src/transforms/hoistStatic.ts

@@ -116,8 +116,9 @@ function isStaticNode(
       if (node.tagType !== ElementTypes.ELEMENT) {
         return false
       }
-      if (resultCache.has(node)) {
-        return resultCache.get(node)!
+      const cached = resultCache.get(node)
+      if (cached !== undefined) {
+        return cached
       }
       const flag = getPatchFlag(node)
       if (!flag || flag === PatchFlags.TEXT) {