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

Method scanBigIntSuffix

internal/scanner/scanner.go:2182–2205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2180}
2181
2182func (s *Scanner) scanBigIntSuffix() ast.Kind {
2183 if s.char() == 'n' {
2184 s.tokenValue += "n"
2185 if s.tokenFlags&ast.TokenFlagsBinaryOrOctalSpecifier != 0 {
2186 s.tokenValue = jsnum.ParsePseudoBigInt(s.tokenValue) + "n"
2187 }
2188 s.pos++
2189 return ast.KindBigIntLiteral
2190 }
2191 if s.numberCache == nil {
2192 s.numberCache = make(map[string]string)
2193 }
2194 if cached, ok := s.numberCache[s.tokenValue]; ok {
2195 s.tokenValue = cached
2196 } else {
2197 tokenValue := jsnum.FromString(s.tokenValue).String()
2198 if tokenValue == s.tokenValue {
2199 tokenValue = s.tokenValue
2200 }
2201 s.numberCache[s.tokenValue] = tokenValue
2202 s.tokenValue = tokenValue
2203 }
2204 return ast.KindNumericLiteral
2205}
2206
2207func (s *Scanner) scanInvalidCharacter() {
2208 _, size := s.charAndSize()

Callers 2

ScanMethod · 0.95
scanNumberMethod · 0.95

Calls 5

charMethod · 0.95
ParsePseudoBigIntFunction · 0.92
FromStringFunction · 0.92
StringMethod · 0.65
makeFunction · 0.50

Tested by

no test coverage detected