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)
| 225 | // addMacroCall adds the macro the the MacroCalls map in source info. If a macro has args/subargs/target |
| 226 | // that are macros, their ID will be stored instead for later self-lookups. |
| 227 | func (p *parserHelper) addMacroCall(exprID int64, function string, target ast.Expr, args ...ast.Expr) { |
| 228 | macroArgs := make([]ast.Expr, len(args)) |
| 229 | for index, arg := range args { |
| 230 | macroArgs[index] = p.buildMacroCallArg(arg) |
| 231 | } |
| 232 | if target == nil { |
| 233 | p.sourceInfo.SetMacroCall(exprID, p.exprFactory.NewCall(0, function, macroArgs...)) |
| 234 | return |
| 235 | } |
| 236 | macroTarget := target |
| 237 | if _, found := p.sourceInfo.GetMacroCall(target.ID()); found { |
| 238 | macroTarget = p.exprFactory.NewUnspecifiedExpr(target.ID()) |
| 239 | } else { |
| 240 | macroTarget = p.buildMacroCallArg(target) |
| 241 | } |
| 242 | p.sourceInfo.SetMacroCall(exprID, p.exprFactory.NewMemberCall(0, function, macroTarget, macroArgs...)) |
| 243 | } |
| 244 | |
| 245 | // logicManager compacts logical trees into a more efficient structure which is semantically |
| 246 | // equivalent with how the logic graph is constructed by the ANTLR parser. |
no test coverage detected