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 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) | 1016 » else if(s->pkg == builtinpkg && importpkg != nil) |
| 1017 » » // The name of embedded builtins during imports belongs to impor
tpkg. |
1017 n = newname(pkglookup(name, importpkg)); | 1018 n = newname(pkglookup(name, importpkg)); |
1018 else | 1019 else |
1019 n = newname(pkglookup(name, s->pkg)); | 1020 n = newname(pkglookup(name, s->pkg)); |
1020 n = nod(ODCLFIELD, n, oldname(s)); | 1021 n = nod(ODCLFIELD, n, oldname(s)); |
1021 n->embedded = 1; | 1022 n->embedded = 1; |
1022 return n; | 1023 return n; |
1023 } | 1024 } |
1024 | 1025 |
1025 /* | 1026 /* |
1026 * 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 |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 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); |
1412 | 1413 |
1413 stksize = 0; | 1414 stksize = 0; |
1414 dclcontext = PAUTO; | 1415 dclcontext = PAUTO; |
1415 funcdepth = n->funcdepth + 1; | 1416 funcdepth = n->funcdepth + 1; |
1416 compile(n); | 1417 compile(n); |
1417 curfn = nil; | 1418 curfn = nil; |
1418 funcdepth = 0; | 1419 funcdepth = 0; |
1419 dclcontext = PEXTERN; | 1420 dclcontext = PEXTERN; |
1420 } | 1421 } |
LEFT | RIGHT |