MCPcopy Create free account
hub / github.com/microsoft/typescript-go / IsDynamicName

Function IsDynamicName

internal/ast/utilities.go:1582–1593  ·  view source on GitHub ↗
(name *Node)

Source from the content-addressed store, hash-verified

1580}
1581
1582func IsDynamicName(name *Node) bool {
1583 var expr *Node
1584 switch name.Kind {
1585 case KindComputedPropertyName:
1586 expr = name.Expression()
1587 case KindElementAccessExpression:
1588 expr = SkipParentheses(name.AsElementAccessExpression().ArgumentExpression)
1589 default:
1590 return false
1591 }
1592 return !IsStringOrNumericLiteralLike(expr) && !IsSignedNumericLiteral(expr)
1593}
1594
1595func IsEntityNameExpression(node *Node) bool {
1596 return IsEntityNameExpressionEx(node, false /*allowJS*/)

Callers 3

HasDynamicNameFunction · 0.85

Calls 5

SkipParenthesesFunction · 0.85
IsSignedNumericLiteralFunction · 0.85
ExpressionMethod · 0.80

Tested by

no test coverage detected