NewHasMacro generates a test-only select expression to be included within an AST and an unexpanded has() macro call signature to be inserted into the source info macro call metadata.
(macroID int64, s ast.Expr)
| 434 | // NewHasMacro generates a test-only select expression to be included within an AST and an unexpanded |
| 435 | // has() macro call signature to be inserted into the source info macro call metadata. |
| 436 | func (opt *optimizerExprFactory) NewHasMacro(macroID int64, s ast.Expr) (astExpr, macroExpr ast.Expr) { |
| 437 | sel := s.AsSelect() |
| 438 | astExpr = opt.fac.NewPresenceTest(macroID, sel.Operand(), sel.FieldName()) |
| 439 | macroExpr = opt.fac.NewCall(0, "has", |
| 440 | opt.NewSelect(opt.fac.CopyExpr(sel.Operand()), sel.FieldName())) |
| 441 | opt.sanitizeMacro(macroID, macroExpr) |
| 442 | return |
| 443 | } |
| 444 | |
| 445 | // NewSelect creates a select expression where a field value is selected from an operand. |
| 446 | // |