ShortenFunctionName returns a shortened version of a function's name.
(f string)
| 464 | |
| 465 | // ShortenFunctionName returns a shortened version of a function's name. |
| 466 | func ShortenFunctionName(f string) string { |
| 467 | f = cppAnonymousPrefixRegExp.ReplaceAllString(f, "") |
| 468 | f = goVerRegExp.ReplaceAllString(f, `${1}${2}`) |
| 469 | for _, re := range []*regexp.Regexp{goRegExp, javaRegExp, cppRegExp} { |
| 470 | if matches := re.FindStringSubmatch(f); len(matches) >= 2 { |
| 471 | return strings.Join(matches[1:], "") |
| 472 | } |
| 473 | } |
| 474 | return f |
| 475 | } |
| 476 | |
| 477 | // TrimTree trims a Graph in forest form, keeping only the nodes in kept. This |
| 478 | // will not work correctly if even a single node has multiple parents. |
no outgoing calls
searching dependent graphs…