a few more blank tests

R=ken
OCL=34500
CL=34500
This commit is contained in:
Russ Cox 2009-09-09 16:59:41 -07:00
parent 079e038aca
commit aa6e81dd71
4 changed files with 21 additions and 10 deletions

View file

@ -1123,8 +1123,8 @@ methodname1(Node *n, Node *t)
star = "*";
t = t->left;
}
if(t->sym == S)
return n;
if(t->sym == S || isblank(n))
return newname(n->sym);
snprint(buf, sizeof(buf), "%s%S·%S", star, t->sym, n->sym);
return newname(pkglookup(buf, t->sym->package));
}

View file

@ -176,6 +176,8 @@ import_stmt:
importdot(import);
break;
}
if(my->name[0] == '_' && my->name[1] == '\0')
break;
// TODO(rsc): this line is needed for a package
// which does bytes := in a function, which creates
@ -212,8 +214,8 @@ import_here:
$$ = parserline();
pkgimportname = S;
pkgmyname = $1;
if(pkgmyname->def)
redeclare(pkgmyname, "as imported package name");
if($1->def && ($1->name[0] != '_' || $1->name[1] != '\0'))
redeclare($1, "as imported package name");
importfile(&$2);
}
| '.' LLITERAL
@ -1172,6 +1174,7 @@ xdcl_list:
| xdcl_list xdcl
{
$$ = concat($1, $2);
testdclstack();
}
vardcl_list:

View file

@ -1982,12 +1982,13 @@ typecheckfunc(Node *n)
{
Type *t, *rcvr;
//dump("nname", n->nname);
typecheck(&n->nname, Erv | Easgn);
if((t = n->nname->type) == T)
return;
n->type = t;
rcvr = getthisx(t)->type;
if(rcvr != nil && n->shortname != N)
if(rcvr != nil && n->shortname != N && !isblank(n->shortname))
addmethod(n->shortname->sym, t, 1);
}

View file

@ -6,12 +6,20 @@
package main
import _ "fmt"
var call string
type T struct {
_, _, _ int;
}
func (T) _() {
}
func (T) _() {
}
const (
c0 = iota;
_;
@ -44,8 +52,7 @@ func i() int {
return 23;
}
func main()
{
func main() {
_, _ = f();
a, _ := f();
if a != 1 {panic(a)}