summaryrefslogtreecommitdiff
path: root/src/cmd/gc/subr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/gc/subr.c')
-rw-r--r--src/cmd/gc/subr.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c
index 2098794a7..bb2505694 100644
--- a/src/cmd/gc/subr.c
+++ b/src/cmd/gc/subr.c
@@ -488,7 +488,7 @@ algtype(Type *t)
{
int a;
- if(issimple[t->etype] || isptr[t->etype] || iscomplex[t->etype] ||
+ if(issimple[t->etype] || isptr[t->etype] ||
t->etype == TCHAN || t->etype == TFUNC || t->etype == TMAP) {
if(t->width == widthptr)
a = AMEMWORD;
@@ -660,12 +660,10 @@ nodbool(int b)
Type*
aindex(Node *b, Type *t)
{
- NodeList *init;
Type *r;
int bound;
bound = -1; // open bound
- init = nil;
typecheck(&b, Erv);
if(b != nil) {
switch(consttype(b)) {
@@ -1266,7 +1264,12 @@ Tpretty(Fmt *fp, Type *t)
case TINTER:
fmtprint(fp, "interface {");
for(t1=t->type; t1!=T; t1=t1->down) {
- fmtprint(fp, " %hS%hhT", t1->sym, t1->type);
+ fmtprint(fp, " ");
+ if(exportname(t1->sym->name))
+ fmtprint(fp, "%hS", t1->sym);
+ else
+ fmtprint(fp, "%S", t1->sym);
+ fmtprint(fp, "%hhT", t1->type);
if(t1->down)
fmtprint(fp, ";");
}
@@ -1728,17 +1731,13 @@ isideal(Type *t)
Type*
methtype(Type *t)
{
- int ptr;
-
if(t == T)
return T;
// strip away pointer if it's there
- ptr = 0;
if(isptr[t->etype]) {
if(t->sym != S)
return T;
- ptr = 1;
t = t->type;
if(t == T)
return T;
@@ -1929,13 +1928,14 @@ assignop(Type *src, Type *dst, char **why)
}
return 0;
}
+ if(isptrto(dst, TINTER)) {
+ if(why != nil)
+ *why = smprint(":\n\t%T is pointer to interface, not interface", dst);
+ return 0;
+ }
if(src->etype == TINTER && dst->etype != TBLANK) {
- if(why != nil) {
- if(isptrto(dst, TINTER))
- *why = smprint(":\n\t%T is interface, not pointer to interface", src);
- else
- *why = ": need type assertion";
- }
+ if(why != nil)
+ *why = ": need type assertion";
return 0;
}