Remove the implicit out variable

This commit is contained in:
Nigel Tao committed 2018-07-29 10:10:58 +10:00
1 parent 9919d78245
commit 58ded30954
4 files changed
+3 -14

No files matched your search

+2 -2
View File
@@ -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
-8
View File
@@ -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 {
-1
View File
@@ -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)
)
+1 -3
View File
@@ -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",