code: func (p *Planner) Plan() (*ir.Policy, error) {
  
  	for _, q := range p.queries {
  		p.curr = &ir.Block{}
  		defined := false
  
  		if err := p.planQuery(q, 0, func() error {
  			p.appendStmt(ir.ReturnStmt{
  				Code: ir.Defined,
  			})
  			defined = true
  			return nil
  		}); err != nil {
  			return nil, err
  		}
  
  		if defined {
  			p.blocks = append(p.blocks, *p.curr)
  		}
  	}
  
  	p.blocks = append(p.blocks, ir.Block{
  		Stmts: []ir.Stmt{
  			ir.ReturnStmt{
  				Code: ir.Undefined,
  			},
  		},
  	})
  
  	policy := ir.Policy{
  		Static: ir.Static{
  			Strings: p.strings,
  		},
  		Plan: ir.Plan{
  			Blocks: p.blocks,
  		},
  	}
  
  	return &policy, nil
  }
docs: // Plan returns a IR plan for the policy query.