LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include <u.h> | 5 #include <u.h> |
6 #include <libc.h> | 6 #include <libc.h> |
7 #include "go.h" | 7 #include "go.h" |
8 #include "y.tab.h" | 8 #include "y.tab.h" |
9 | 9 |
10 static void funcargs(Node*); | 10 static void funcargs(Node*); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 c = nod(ONAME, N, N); | 408 c = nod(ONAME, N, N); |
409 c->sym = s; | 409 c->sym = s; |
410 c->class = PPARAMREF; | 410 c->class = PPARAMREF; |
411 c->isddd = n->isddd; | 411 c->isddd = n->isddd; |
412 c->defn = n; | 412 c->defn = n; |
413 c->addable = 0; | 413 c->addable = 0; |
414 c->ullman = 2; | 414 c->ullman = 2; |
415 c->funcdepth = funcdepth; | 415 c->funcdepth = funcdepth; |
416 c->outer = n->closure; | 416 c->outer = n->closure; |
417 n->closure = c; | 417 n->closure = c; |
| 418 n->addrtaken = 1; |
418 c->closure = n; | 419 c->closure = n; |
419 c->xoffset = 0; | 420 c->xoffset = 0; |
420 curfn->cvars = list(curfn->cvars, c); | 421 curfn->cvars = list(curfn->cvars, c); |
421 } | 422 } |
422 // return ref to closure var, not original | 423 // return ref to closure var, not original |
423 return n->closure; | 424 return n->closure; |
424 } | 425 } |
425 return n; | 426 return n; |
426 } | 427 } |
427 | 428 |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 suffix = ""; | 1082 suffix = ""; |
1082 if(iface) { | 1083 if(iface) { |
1083 dowidth(t0); | 1084 dowidth(t0); |
1084 if(t0->width < types[tptr]->width) | 1085 if(t0->width < types[tptr]->width) |
1085 suffix = "·i"; | 1086 suffix = "·i"; |
1086 } | 1087 } |
1087 if(t0->sym == S && isptr[t0->etype]) | 1088 if(t0->sym == S && isptr[t0->etype]) |
1088 p = smprint("(%-hT).%s%s", t0, nsym->name, suffix); | 1089 p = smprint("(%-hT).%s%s", t0, nsym->name, suffix); |
1089 else | 1090 else |
1090 p = smprint("%-hT.%s%s", t0, nsym->name, suffix); | 1091 p = smprint("%-hT.%s%s", t0, nsym->name, suffix); |
1091 // print("methodsym: %s\n", p); | |
1092 s = pkglookup(p, s->pkg); | 1092 s = pkglookup(p, s->pkg); |
| 1093 //print("methodsym:%s -> %+S\n", p, s); |
1093 free(p); | 1094 free(p); |
1094 return s; | 1095 return s; |
1095 | 1096 |
1096 bad: | 1097 bad: |
1097 yyerror("illegal receiver type: %T", t0); | 1098 yyerror("illegal receiver type: %T", t0); |
1098 return S; | 1099 return S; |
1099 } | 1100 } |
1100 | 1101 |
1101 Node* | 1102 Node* |
1102 methodname(Node *n, Type *t) | 1103 methodname(Node *n, Type *t) |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 dclcontext = PAUTO; | 1252 dclcontext = PAUTO; |
1252 funcdepth = n->funcdepth + 1; | 1253 funcdepth = n->funcdepth + 1; |
1253 compile(n); | 1254 compile(n); |
1254 curfn = nil; | 1255 curfn = nil; |
1255 funcdepth = 0; | 1256 funcdepth = 0; |
1256 dclcontext = PEXTERN; | 1257 dclcontext = PEXTERN; |
1257 } | 1258 } |
1258 | 1259 |
1259 | 1260 |
1260 | 1261 |
LEFT | RIGHT |