Rename the implicit in variable to args

This commit is contained in:
Nigel Tao committed 2018-07-29 10:26:22 +10:00
1 parent 58ded30954
commit ca06083f8a
19 files changed
+254 -252

No files matched your search

+4 -4
View File
@@ -196,9 +196,9 @@ loop:
}
// o is a yield statement.
//
// Drop any facts involving in or this.
// Drop any facts involving args or this.
if err := q.facts.update(func(x *a.Expr) (*a.Expr, error) {
if x.Mentions(exprIn) || x.Mentions(exprThis) {
if x.Mentions(exprArgs) || x.Mentions(exprThis) {
return nil, nil
}
return x, nil
@@ -857,8 +857,8 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (a.Bounds, error) {
return a.Bounds{}, err
}
// TODO: delete this hack that only matches "in".
if n.LHS().AsExpr().Ident() == t.IDIn {
// TODO: delete this hack that only matches "args".
if n.LHS().AsExpr().Ident() == t.IDArgs {
for _, o := range q.astFunc.In().Fields() {
o := o.AsField()
if o.Name() == n.Ident() {
+2 -2
View File
@@ -418,7 +418,7 @@ func (c *Checker) checkStructDecl(node *a.Node) error {
setPlaceholderMBoundsMType(n.AsNode())
// A struct declaration implies a reset method.
in := a.NewStruct(0, n.Filename(), n.Line(), t.IDIn, nil)
in := a.NewStruct(0, n.Filename(), n.Line(), t.IDArgs, nil)
f := a.NewFunc(0, n.Filename(), n.Line(), qid[1], t.IDReset, in, nil, nil, nil)
if qid[0] != 0 {
f.AsNode().AsRaw().SetPackage(c.tm, qid[0])
@@ -548,7 +548,7 @@ func (c *Checker) checkFuncSignature(node *a.Node) error {
inTyp.AsNode().SetMType(typeExprTypeExpr)
localVars := typeMap{
t.IDIn: inTyp,
t.IDArgs: inTyp,
}
if qqid[1] != 0 {
if _, ok := c.structs[t.QID{qqid[0], qqid[1]}]; !ok {
+2 -2
View File
@@ -27,9 +27,9 @@ import (
)
var (
exprIn = a.NewExpr(0, 0, 0, t.IDIn, nil, nil, nil, nil)
exprThis = a.NewExpr(0, 0, 0, t.IDThis, nil, nil, nil, nil)
exprArgs = a.NewExpr(0, 0, 0, t.IDArgs, nil, nil, nil, nil)
exprNullptr = a.NewExpr(0, 0, 0, t.IDNullptr, nil, nil, nil, nil)
exprThis = a.NewExpr(0, 0, 0, t.IDThis, nil, nil, nil, nil)
)
var (
+1 -1
View File
@@ -632,7 +632,7 @@ func (q *checker) tcheckDot(n *a.Expr, depth uint32) error {
}
s := (*a.Struct)(nil)
if q.astFunc != nil && lQID[0] == 0 && lQID[1] == t.IDIn {
if q.astFunc != nil && lQID[0] == 0 && lQID[1] == t.IDArgs {
s = q.astFunc.In()
}
if s == nil {