MCPcopy Index your code
hub / github.com/microsoft/typescript-go / writeTokenText

Method writeTokenText

internal/printer/printer.go:920–930  ·  view source on GitHub ↗

Tokens/Keywords

(token ast.Kind, writeKind WriteKind, pos int)

Source from the content-addressed store, hash-verified

918//
919
920func (p *Printer) writeTokenText(token ast.Kind, writeKind WriteKind, pos int) int {
921 // !!! emit leading and trailing comments
922 // !!! emit leading and trailing source maps
923 tokenString := scanner.TokenToString(token)
924 p.writeAs(tokenString, writeKind)
925 if ast.PositionIsSynthesized(pos) {
926 return pos
927 } else {
928 return pos + len(tokenString)
929 }
930}
931
932func (p *Printer) emitToken(token ast.Kind, pos int, writeKind WriteKind, contextNode *ast.Node) int {
933 return p.emitTokenEx(token, pos, writeKind, contextNode, tefNone)

Callers 4

emitTokenExMethod · 0.95
emitKeywordNodeExMethod · 0.95
emitPunctuationNodeExMethod · 0.95

Calls 4

writeAsMethod · 0.95
TokenToStringFunction · 0.92
PositionIsSynthesizedFunction · 0.92
lenFunction · 0.85

Tested by

no test coverage detected