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

Function canUsePropertyAccess

internal/checker/nodebuilderimpl.go:906–916  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

904}
905
906func canUsePropertyAccess(name string) bool {
907 if len(name) == 0 {
908 return false
909 }
910 // TODO: in strada, this only used `isIdentifierStart` on the first character, while this checks the whole string for validity
911 // - possible strada bug?
912 if strings.HasPrefix(name, "#") {
913 return len(name) > 1 && scanner.IsIdentifierText(name[1:], core.LanguageVariantStandard)
914 }
915 return scanner.IsIdentifierText(name, core.LanguageVariantStandard)
916}
917
918func startsWithSingleOrDoubleQuote(str string) bool {
919 return strings.HasPrefix(str, "'") || strings.HasPrefix(str, "\"")

Callers 1

Calls 2

IsIdentifierTextFunction · 0.92
lenFunction · 0.85

Tested by

no test coverage detected