From 58ded30954ff59f5a407f07f2846c34b837eb5a6 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Sun, 29 Jul 2018 10:10:58 +1000 Subject: [PATCH] Remove the implicit out variable --- lang/check/bounds.go | 4 ++-- lang/check/check.go | 8 -------- lang/check/resolve.go | 1 - lang/token/list.go | 4 +--- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/lang/check/bounds.go b/lang/check/bounds.go index 189efe47..1bc75303 100644 --- a/lang/check/bounds.go +++ b/lang/check/bounds.go @@ -196,9 +196,9 @@ loop: } // o is a yield statement. // - // Drop any facts involving in, out or this. + // Drop any facts involving in or this. if err := q.facts.update(func(x *a.Expr) (*a.Expr, error) { - if x.Mentions(exprIn) || x.Mentions(exprOut) || x.Mentions(exprThis) { + if x.Mentions(exprIn) || x.Mentions(exprThis) { return nil, nil } return x, nil diff --git a/lang/check/check.go b/lang/check/check.go index eae13446..648b7c9a 100644 --- a/lang/check/check.go +++ b/lang/check/check.go @@ -547,16 +547,8 @@ func (c *Checker) checkFuncSignature(node *a.Node) error { inTyp.AsNode().SetMBounds(a.Bounds{zero, zero}) inTyp.AsNode().SetMType(typeExprTypeExpr) - outTyp := n.Out() - if outTyp == nil { - outTyp = typeExprEmptyStruct - } - localVars := typeMap{ t.IDIn: inTyp, - // TODO: drop the implicit "out" variable (and exprOut in this - // package)? - t.IDOut: outTyp, } if qqid[1] != 0 { if _, ok := c.structs[t.QID{qqid[0], qqid[1]}]; !ok { diff --git a/lang/check/resolve.go b/lang/check/resolve.go index 18e0a722..c6748857 100644 --- a/lang/check/resolve.go +++ b/lang/check/resolve.go @@ -28,7 +28,6 @@ import ( var ( exprIn = a.NewExpr(0, 0, 0, t.IDIn, nil, nil, nil, nil) - exprOut = a.NewExpr(0, 0, 0, t.IDOut, nil, nil, nil, nil) exprThis = a.NewExpr(0, 0, 0, t.IDThis, nil, nil, nil, nil) exprNullptr = a.NewExpr(0, 0, 0, t.IDNullptr, nil, nil, nil, nil) ) diff --git a/lang/token/list.go b/lang/token/list.go index 17fbe741..31358214 100644 --- a/lang/token/list.go +++ b/lang/token/list.go @@ -445,8 +445,7 @@ const ( IDThis = ID(0x130) IDIn = ID(0x131) - IDOut = ID(0x132) - IDBase = ID(0x133) + IDBase = ID(0x132) // TODO Read/Write 24 bits? It might be useful for RGB triples. @@ -735,7 +734,6 @@ var builtInsByID = [nBuiltInIDs]string{ IDThis: "this", IDIn: "in", - IDOut: "out", IDBase: "base", IDUndoByte: "undo_byte",