Skip to content

Commit

Permalink
Remove redundant error checks in compiler/kernel
Browse files Browse the repository at this point in the history
These checks already exist in compiler/semantic.
  • Loading branch information
nwt committed Oct 9, 2024
1 parent b05e70b commit bdf1626
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
3 changes: 0 additions & 3 deletions compiler/kernel/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,6 @@ func (b *Builder) compileMapExpr(m *dag.MapExpr) (expr.Evaluator, error) {
}

func (b *Builder) compileOverExpr(over *dag.OverExpr) (expr.Evaluator, error) {
if over.Body == nil {
return nil, errors.New("over expression requires a lateral query body")
}
names, lets, err := b.compileDefs(over.Defs)
if err != nil {
return nil, err
Expand Down
12 changes: 1 addition & 11 deletions compiler/kernel/op.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,9 @@ func (b *Builder) compileLeaf(o dag.Op, parent zbuf.Puller) (zbuf.Puller, error)
cutter := expr.NewCutter(b.zctx(), lhs, rhs)
return op.NewApplier(b.rctx, parent, cutter, b.resetters), nil
case *dag.Drop:
if len(v.Args) == 0 {
return nil, errors.New("drop: no fields given")
}
fields := make(field.List, 0, len(v.Args))
for _, e := range v.Args {
field, ok := e.(*dag.This)
if !ok {
return nil, errors.New("drop: arg not a field")
}
fields = append(fields, field.Path)
fields = append(fields, e.(*dag.This).Path)
}
dropper := expr.NewDropper(b.zctx(), fields)
return op.NewApplier(b.rctx, parent, dropper, expr.Resetters{}), nil
Expand Down Expand Up @@ -389,9 +382,6 @@ func (b *Builder) compileDefs(defs []dag.Def) ([]string, []expr.Evaluator, error
}

func (b *Builder) compileOver(parent zbuf.Puller, over *dag.Over) (zbuf.Puller, error) {
if len(over.Defs) != 0 && over.Body == nil {
return nil, errors.New("internal error: over operator has defs but no body")
}
b.resetResetters()
withNames, withExprs, err := b.compileDefs(over.Defs)
if err != nil {
Expand Down

0 comments on commit bdf1626

Please sign in to comment.