OLD | NEW |
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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 // making the name for the embedded struct field. | 1006 // making the name for the embedded struct field. |
1007 enum { CenterDot = 0xB7 }; | 1007 enum { CenterDot = 0xB7 }; |
1008 name = s->name; | 1008 name = s->name; |
1009 if(utfrune(s->name, CenterDot)) { | 1009 if(utfrune(s->name, CenterDot)) { |
1010 name = strdup(s->name); | 1010 name = strdup(s->name); |
1011 *utfrune(name, CenterDot) = 0; | 1011 *utfrune(name, CenterDot) = 0; |
1012 } | 1012 } |
1013 | 1013 |
1014 if(exportname(name)) | 1014 if(exportname(name)) |
1015 n = newname(lookup(name)); | 1015 n = newname(lookup(name)); |
| 1016 else if(s->pkg == builtinpkg && importpkg != nil) |
| 1017 // The name of embedded builtins during imports belongs to impor
tpkg. |
| 1018 n = newname(pkglookup(name, importpkg)); |
1016 else | 1019 else |
1017 n = newname(pkglookup(name, s->pkg)); | 1020 n = newname(pkglookup(name, s->pkg)); |
1018 n = nod(ODCLFIELD, n, oldname(s)); | 1021 n = nod(ODCLFIELD, n, oldname(s)); |
1019 n->embedded = 1; | 1022 n->embedded = 1; |
1020 return n; | 1023 return n; |
1021 } | 1024 } |
1022 | 1025 |
1023 /* | 1026 /* |
1024 * check that the list of declarations is either all anonymous or all named | 1027 * check that the list of declarations is either all anonymous or all named |
1025 */ | 1028 */ |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 fatal("funccompile %S inside %S", n->nname->sym, curfn->nname->s
ym); | 1412 fatal("funccompile %S inside %S", n->nname->sym, curfn->nname->s
ym); |
1410 | 1413 |
1411 stksize = 0; | 1414 stksize = 0; |
1412 dclcontext = PAUTO; | 1415 dclcontext = PAUTO; |
1413 funcdepth = n->funcdepth + 1; | 1416 funcdepth = n->funcdepth + 1; |
1414 compile(n); | 1417 compile(n); |
1415 curfn = nil; | 1418 curfn = nil; |
1416 funcdepth = 0; | 1419 funcdepth = 0; |
1417 dclcontext = PEXTERN; | 1420 dclcontext = PEXTERN; |
1418 } | 1421 } |
OLD | NEW |