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

Function classifyPropertyName

internal/checker/nodebuilderimpl.go:2357–2365  ·  view source on GitHub ↗
(name string, stringNamed bool, isMethod bool)

Source from the content-addressed store, hash-verified

2355)
2356
2357func classifyPropertyName(name string, stringNamed bool, isMethod bool) propertyNameNodeKind {
2358 if isMethod && name == "new" {
2359 return propertyNameNodeKindStringLiteral
2360 }
2361 if scanner.IsIdentifierText(name, core.LanguageVariantStandard) {
2362 return propertyNameNodeKindIdentifier
2363 }
2364 return core.IfElse(!stringNamed && isNumericLiteralName(name) && jsnum.FromString(name) >= 0, propertyNameNodeKindNumericLiteral, propertyNameNodeKindStringLiteral)
2365}
2366
2367func (b *NodeBuilderImpl) createPropertyNameNodeForIdentifierOrLiteral(name string, singleQuote bool, stringNamed bool, isMethod bool, symbol *ast.Symbol) *ast.Node {
2368 switch classifyPropertyName(name, stringNamed, isMethod) {

Callers 2

reuseNameMethod · 0.85

Calls 4

IsIdentifierTextFunction · 0.92
IfElseFunction · 0.92
FromStringFunction · 0.92
isNumericLiteralNameFunction · 0.85

Tested by

no test coverage detected