An alias symbol is created by one of the following declarations: import = ... const = ... (JS only) const { , ... } = ... (JS only) import from ... import * as from ... import { x as } from ... export { x as } from ... export * a
(node *Node)
| 2610 | // module.exports.<symbol> = <EntityNameExpression> (JS only) |
| 2611 | // exports.<symbol> = <EntityNameExpression> (JS only) |
| 2612 | func IsAliasSymbolDeclaration(node *Node) bool { |
| 2613 | switch node.Kind { |
| 2614 | case KindImportEqualsDeclaration, KindNamespaceExportDeclaration, KindNamespaceImport, KindNamespaceExport, |
| 2615 | KindImportSpecifier, KindExportSpecifier: |
| 2616 | return true |
| 2617 | case KindImportClause: |
| 2618 | return node.AsImportClause().Name() != nil |
| 2619 | case KindExportAssignment: |
| 2620 | return ExpressionIsAlias(node.Expression()) |
| 2621 | case KindVariableDeclaration, KindBindingElement: |
| 2622 | return IsVariableDeclarationInitializedToRequire(node) |
| 2623 | case KindBinaryExpression: |
| 2624 | switch GetAssignmentDeclarationKind(node) { |
| 2625 | case JSDeclarationKindModuleExports, JSDeclarationKindExportsProperty: |
| 2626 | return ExpressionIsAlias(node.AsBinaryExpression().Right) |
| 2627 | } |
| 2628 | } |
| 2629 | return false |
| 2630 | } |
| 2631 | |
| 2632 | func IsParseTreeNode(node *Node) bool { |
| 2633 | return node.Flags&NodeFlagsSynthesized == 0 |
no test coverage detected