(source *ast.SourceInfo)
| 2187 | } |
| 2188 | |
| 2189 | func convertMacroCallsToString(source *ast.SourceInfo) string { |
| 2190 | macroCalls := source.MacroCalls() |
| 2191 | keys := make([]int64, len(macroCalls)) |
| 2192 | adornedStrings := make([]string, len(macroCalls)) |
| 2193 | i := 0 |
| 2194 | for k := range macroCalls { |
| 2195 | keys[i] = k |
| 2196 | i++ |
| 2197 | } |
| 2198 | fac := ast.NewExprFactory() |
| 2199 | // Sort the keys in descending order to create a stable ordering for tests and improve readability. |
| 2200 | sort.Slice(keys, func(i, j int) bool { return keys[i] > keys[j] }) |
| 2201 | i = 0 |
| 2202 | for _, key := range keys { |
| 2203 | call := macroCalls[int64(key)].AsCall() |
| 2204 | var callWithID ast.Expr |
| 2205 | if call.IsMemberFunction() { |
| 2206 | callWithID = fac.NewMemberCall(int64(key), call.FunctionName(), call.Target(), call.Args()...) |
| 2207 | } else { |
| 2208 | callWithID = fac.NewCall(int64(key), call.FunctionName(), call.Args()...) |
| 2209 | } |
| 2210 | adornedStrings[i] = debug.ToAdornedDebugString( |
| 2211 | callWithID, |
| 2212 | &kindAndIDAdorner{sourceInfo: source}) |
| 2213 | i++ |
| 2214 | } |
| 2215 | return strings.Join(adornedStrings, ",\n") |
| 2216 | } |
| 2217 | |
| 2218 | func TestParse(t *testing.T) { |
| 2219 | defaultParser := newTestParser(t) |
no test coverage detected