Skip to content

Commit 1fbef67

Browse files
authored
compiler/semantic: remove fuser.Type parameter (#6362)
This simplifies fuser's API a little.
1 parent f57a948 commit 1fbef67

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

compiler/semantic/checker.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ func (c *checker) arrayElems(typ super.Type, elems []sem.ArrayElem) super.Type {
452452
panic(elem)
453453
}
454454
}
455-
return fuser.Type(c)
455+
return fuser.Type()
456456
}
457457

458458
func (c *checker) recordElems(typ super.Type, elems []sem.RecordElem) super.Type {
@@ -474,7 +474,7 @@ func (c *checker) recordElems(typ super.Type, elems []sem.RecordElem) super.Type
474474
panic(elem)
475475
}
476476
}
477-
return fuser.Type(c)
477+
return fuser.Type()
478478
}
479479

480480
func (c *checker) callBuiltin(call *sem.CallExpr, args []super.Type) super.Type {
@@ -520,7 +520,7 @@ func (c *checker) pathsToType(paths []pathType) super.Type {
520520
for _, path := range paths {
521521
fuser.fuse(c.pathToRec(path.typ, path.elems))
522522
}
523-
return fuser.Type(c)
523+
return fuser.Type()
524524
}
525525

526526
func (c *checker) pathToRec(typ super.Type, elems []string) super.Type {
@@ -593,7 +593,7 @@ func (c *checker) putPaths(typ super.Type, puts []pathType) super.Type {
593593
for _, put := range puts {
594594
fuser.fuse(c.pathToRec(put.typ, put.elems))
595595
}
596-
return fuser.Type(c)
596+
return fuser.Type()
597597
}
598598

599599
type path struct {
@@ -624,7 +624,7 @@ func (c *checker) fuse(types []super.Type) super.Type {
624624
for _, typ := range types {
625625
fuser.fuse(typ)
626626
}
627-
return fuser.Type(c)
627+
return fuser.Type()
628628
}
629629

630630
func (c *checker) boolean(loc ast.Node, typ super.Type) bool {
@@ -1063,13 +1063,15 @@ func (c *checker) error(loc ast.Node, err error) {
10631063
}
10641064

10651065
func (c *checker) newFuser() *fuser {
1066-
return &fuser{sctx: c.t.sctx}
1066+
return &fuser{sctx: c.t.sctx, unknown: c.unknown}
10671067
}
10681068

10691069
type fuser struct {
1070-
sctx *super.Context
1071-
typ super.Type
1072-
sch *agg.Schema
1070+
sctx *super.Context
1071+
unknown super.Type
1072+
1073+
typ super.Type
1074+
sch *agg.Schema
10731075
}
10741076

10751077
func (f *fuser) fuse(typ super.Type) {
@@ -1084,12 +1086,12 @@ func (f *fuser) fuse(typ super.Type) {
10841086
}
10851087
}
10861088

1087-
func (f *fuser) Type(c *checker) super.Type {
1089+
func (f *fuser) Type() super.Type {
10881090
if f.sch != nil {
10891091
return f.sch.Type()
10901092
}
10911093
if f.typ != nil {
10921094
return f.typ
10931095
}
1094-
return c.unknown
1096+
return f.unknown
10951097
}

compiler/semantic/op.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ func (t *translator) semOp(o ast.Op, seq sem.Seq) sem.Seq {
561561
}
562562
var typ super.Type
563563
if fuser != nil {
564-
typ = fuser.Type(t.checker)
564+
typ = fuser.Type()
565565
}
566566
return append(seq, &sem.FileScan{
567567
Node: o,

0 commit comments

Comments
 (0)