]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: remove unused util function
authorEvan You <yyx990803@gmail.com>
Thu, 24 Oct 2019 19:39:31 +0000 (15:39 -0400)
committerEvan You <yyx990803@gmail.com>
Thu, 24 Oct 2019 19:39:31 +0000 (15:39 -0400)
packages/compiler-core/__tests__/utils.spec.ts
packages/compiler-core/src/utils.ts

index d93d321299b94dd704858e3251198a81cde43915..b5d1bea04c95f2b894ea1b0768579e295337d86a 100644 (file)
@@ -1,9 +1,5 @@
-import { Position, NodeTypes } from '../src/ast'
-import {
-  getInnerRange,
-  advancePositionWithClone,
-  isEmptyExpression
-} from '../src/utils'
+import { Position } from '../src/ast'
+import { getInnerRange, advancePositionWithClone } from '../src/utils'
 
 function p(line: number, column: number, offset: number): Position {
   return { column, line, offset }
@@ -71,41 +67,3 @@ describe('getInnerRange', () => {
     expect(loc2.end.offset).toBe(7)
   })
 })
-
-describe('isEmptyExpression', () => {
-  test('empty', () => {
-    expect(
-      isEmptyExpression({
-        content: '',
-        type: NodeTypes.SIMPLE_EXPRESSION,
-        isStatic: true,
-        isConstant: true,
-        loc: null as any
-      })
-    ).toBe(true)
-  })
-
-  test('spaces', () => {
-    expect(
-      isEmptyExpression({
-        content: '  \t  ',
-        type: NodeTypes.SIMPLE_EXPRESSION,
-        isStatic: true,
-        isConstant: true,
-        loc: null as any
-      })
-    ).toBe(true)
-  })
-
-  test('identifier', () => {
-    expect(
-      isEmptyExpression({
-        content: 'foo',
-        type: NodeTypes.SIMPLE_EXPRESSION,
-        isStatic: true,
-        isConstant: true,
-        loc: null as any
-      })
-    ).toBe(false)
-  })
-})
index 2017d6910bc47d93b788dd3713b1e163f73e3ac8..cb0b562cc65b983144a63d18550cc75c2afc6b15 100644 (file)
@@ -164,7 +164,7 @@ export function findProp(
     const p = node.props[i]
     if (p.type === NodeTypes.ATTRIBUTE) {
       if (dynamicOnly) continue
-      if (p.name === name && p.value && !p.value.isEmpty) {
+      if (p.name === name && p.value) {
         return p
       }
     } else if (
@@ -248,10 +248,6 @@ export function toValidAssetId(
   return `_${type}_${name.replace(/[^\w]/g, '_')}`
 }
 
-export function isEmptyExpression(node: ExpressionNode) {
-  return node.type === NodeTypes.SIMPLE_EXPRESSION && !node.content.trim()
-}
-
 // Check if a node contains expressions that reference current context scope ids
 export function hasScopeRef(
   node: TemplateChildNode | IfBranchNode | ExpressionNode | undefined,