MCPcopy Create free account
hub / github.com/decomp/decomp / ident

Function ident

cmd/ll2go/main.go:492–503  ·  view source on GitHub ↗

ident returns a sanitized version of the given identifier.

(s string)

Source from the content-addressed store, hash-verified

490
491// ident returns a sanitized version of the given identifier.
492func ident(s string) *ast.Ident {
493 s = strings.Replace(s, ".", "dot", -1)
494 f := func(r rune) rune {
495 switch {
496 case unicode.IsLetter(r), unicode.IsNumber(r):
497 // valid rune in identifier.
498 return r
499 }
500 return '_'
501 }
502 return ast.NewIdent(strings.Map(f, s))
503}
504
505// label converts the given LLVM IR basic block label to a corresponding Go
506// identifier.

Callers 5

ll2goFunction · 0.85
typeIdentMethod · 0.85
globalIdentMethod · 0.85
localIdentMethod · 0.85
labelMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected