Repository: vuejs/vue-next
File: packages/compiler-core/src/babelUtils.ts (TypeScript)

Code before:
        // eslint-disable-next-line no-restricted-syntax
        parent?.type === 'ObjectPattern'
      ) {
        // mark property in destructure pattern
        ;(node as any).inPattern = true
      } else if (isFunctionType(node)) {
        if (node.scopeIds) {
          node.scopeIds.forEach(id => markKnownIds(id, knownIds))
        } else {
          // walk function expressions and add its arguments to known identifiers
          // so that we don't prefix them
          walkFunctionParams(node, id =>
            markScopeIdentifier(node, id, knownIds),
          )
        }
      } else if (node.type === 'BlockStatement') {
        if (node.scopeIds) {
          node.scopeIds.forEach(id => markKnownIds(id, knownIds))
        } else {
          // #3445 record block-level local variables
          walkBlockDeclarations(node, id =>
            markScopeIdentifier(node, id, knownIds),
          )
        }
      } else if (node.type === 'SwitchStatement') {
        walkSwitchStatement(node, false, id =>
          markScopeIdentifier(node, id, knownIds),
        )
      } else if (node.type === 'CatchClause' && node.param) {
        for (const id of extractIdentifiers(node.param)) {
          markScopeIdentifier(node, id, knownIds)
        }
      } else if (isForStatement(node)) {
        walkForStatement(node, false, id =>
          markScopeIdentifier(node, id, knownIds),
        )
      }
    },
    leave(node: Node & { scopeIds?: Set<string> }, parent: Node | null) {
      parent && parentStack.pop()
      if (node !== rootExp && node.scopeIds) {
        for (const id of node.scopeIds) {
          knownIds[id]--
          if (knownIds[id] === 0) {
            delete knownIds[id]
          }
        }
      }
    },
  })
}

Review comment (suggestion):
should be:
```js
if (node.scopeIds) {
  node.scopeIds.forEach(id => markKnownIds(id, knownIds))
} else {
  walkSwitchStatment()
}
       
```

Code after:
        // eslint-disable-next-line no-restricted-syntax
        parent?.type === 'ObjectPattern'
      ) {
        // mark property in destructure pattern
        ;(node as any).inPattern = true
      } else if (isFunctionType(node)) {
        if (node.scopeIds) {
          node.scopeIds.forEach(id => markKnownIds(id, knownIds))
        } else {
          // walk function expressions and add its arguments to known identifiers
          // so that we don't prefix them
          walkFunctionParams(node, id =>
            markScopeIdentifier(node, id, knownIds),
          )
        }
      } else if (node.type === 'BlockStatement') {
        if (node.scopeIds) {
          node.scopeIds.forEach(id => markKnownIds(id, knownIds))
        } else {
          // #3445 record block-level local variables
          walkBlockDeclarations(node, id =>
            markScopeIdentifier(node, id, knownIds),
          )
        }
      } else if (node.type === 'SwitchStatement') {
        if (node.scopeIds) {
          node.scopeIds.forEach(id => markKnownIds(id, knownIds))
        } else {
          // record switch case block-level local variables
          walkSwitchStatement(node, false, id =>
            markScopeIdentifier(node, id, knownIds),
          )
        }
      } else if (node.type === 'CatchClause' && node.param) {
        if (node.scopeIds) {
          node.scopeIds.forEach(id => markKnownIds(id, knownIds))
        } else {
          for (const id of extractIdentifiers(node.param)) {
            markScopeIdentifier(node, id, knownIds)
          }
        }
      } else if (isForStatement(node)) {
        if (node.scopeIds) {
          node.scopeIds.forEach(id => markKnownIds(id, knownIds))
        } else {
          walkForStatement(node, false, id =>
            markScopeIdentifier(node, id, knownIds),
          )
        }
      }
    },