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 /* | 5 /* |
6 * function literals aka closures | 6 * function literals aka closures |
7 */ | 7 */ |
8 | 8 |
9 #include "go.h" | 9 #include "go.h" |
10 | 10 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 walkcallclosure(Node *n, NodeList **init) | 231 walkcallclosure(Node *n, NodeList **init) |
232 { | 232 { |
233 if (n->op != OCALLFUNC || n->left->op != OCLOSURE) { | 233 if (n->op != OCALLFUNC || n->left->op != OCLOSURE) { |
234 dump("walkcallclosure", n); | 234 dump("walkcallclosure", n); |
235 fatal("abuse of walkcallclosure"); | 235 fatal("abuse of walkcallclosure"); |
236 } | 236 } |
237 | 237 |
238 // New arg list for n. First the closure-args | 238 // New arg list for n. First the closure-args |
239 // and then the original parameter list. | 239 // and then the original parameter list. |
240 n->list = concat(n->left->enter, n->list); | 240 n->list = concat(n->left->enter, n->list); |
241 | |
242 n->left = makeclosure(n->left, init, 1)->nname; | 241 n->left = makeclosure(n->left, init, 1)->nname; |
243 » dump("walkcallclosure", n); | 242 » dowidth(n->left->type); |
244 } | 243 » n->type = getoutargx(n->left->type); |
| 244 » // for a single valued function, pull the field type out of the struct |
| 245 » if (n->type && n->type->type && !n->type->type->down) |
| 246 » » n->type = n->type->type->type; |
| 247 } |
LEFT | RIGHT |