ident returns a sanitized version of the given identifier.
(s string)
| 490 | |
| 491 | // ident returns a sanitized version of the given identifier. |
| 492 | func 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. |
no outgoing calls
no test coverage detected