addMacroCall adds the macro the the MacroCalls map in source info. If a macro has args/subargs/target that are macros, their ID will be stored instead for later self-lookups.
(exprID int64, function string, target ast.Expr, args ...ast.Expr)
| 266 | // addMacroCall adds the macro the the MacroCalls map in source info. If a macro has args/subargs/target |
| 267 | // that are macros, their ID will be stored instead for later self-lookups. |
| 268 | func (p *parserHelper) addMacroCall(exprID int64, function string, target ast.Expr, args ...ast.Expr) { |
| 269 | macroArgs := make([]ast.Expr, len(args)) |
| 270 | for index, arg := range args { |
| 271 | macroArgs[index] = p.buildMacroCallArg(arg) |
| 272 | } |
| 273 | if target == nil { |
| 274 | p.sourceInfo.SetMacroCall(exprID, p.exprFactory.NewCall(0, function, macroArgs...)) |
| 275 | return |
| 276 | } |
| 277 | macroTarget := target |
| 278 | if _, found := p.sourceInfo.GetMacroCall(target.ID()); found { |
| 279 | macroTarget = p.exprFactory.NewUnspecifiedExpr(target.ID()) |
| 280 | } else { |
| 281 | macroTarget = p.buildMacroCallArg(target) |
| 282 | } |
| 283 | p.sourceInfo.SetMacroCall(exprID, p.exprFactory.NewMemberCall(0, function, macroTarget, macroArgs...)) |
| 284 | } |
| 285 | |
| 286 | // logicManager compacts logical trees into a more efficient structure which is semantically |
| 287 | // equivalent with how the logic graph is constructed by the ANTLR parser. |
no test coverage detected