(name *Node)
| 3139 | } |
| 3140 | |
| 3141 | func GetPropertyNameForPropertyNameNode(name *Node) string { |
| 3142 | switch name.Kind { |
| 3143 | case KindIdentifier, KindPrivateIdentifier, KindStringLiteral, KindNoSubstitutionTemplateLiteral, |
| 3144 | KindNumericLiteral, KindBigIntLiteral, KindJsxNamespacedName: |
| 3145 | return name.Text() |
| 3146 | case KindComputedPropertyName: |
| 3147 | nameExpression := name.Expression() |
| 3148 | if IsStringOrNumericLiteralLike(nameExpression) { |
| 3149 | return nameExpression.Text() |
| 3150 | } |
| 3151 | if IsSignedNumericLiteral(nameExpression) { |
| 3152 | text := nameExpression.AsPrefixUnaryExpression().Operand.Text() |
| 3153 | if nameExpression.AsPrefixUnaryExpression().Operator == KindMinusToken { |
| 3154 | text = "-" + text |
| 3155 | } |
| 3156 | return text |
| 3157 | } |
| 3158 | return InternalSymbolNameMissing |
| 3159 | } |
| 3160 | panic("Unhandled case in getPropertyNameForPropertyNameNode") |
| 3161 | } |
| 3162 | |
| 3163 | func IsPartOfTypeOnlyImportOrExportDeclaration(node *Node) bool { |
| 3164 | return FindAncestor(node, IsTypeOnlyImportOrExportDeclaration) != nil |
no test coverage detected