OLD | NEW |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 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 "opnames.h" | 8 #include "opnames.h" |
9 | 9 |
10 // | 10 // |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 if(s->pkg->name && pkglookup(s->pkg->name, nil)->npkg >
1) | 511 if(s->pkg->name && pkglookup(s->pkg->name, nil)->npkg >
1) |
512 return fmtprint(fp, "\"%Z\".%s", s->pkg->path, s
->name); | 512 return fmtprint(fp, "\"%Z\".%s", s->pkg->path, s
->name); |
513 return fmtprint(fp, "%s.%s", s->pkg->name, s->name); | 513 return fmtprint(fp, "%s.%s", s->pkg->name, s->name); |
514 case FDbg: | 514 case FDbg: |
515 return fmtprint(fp, "%s.%s", s->pkg->name, s->name); | 515 return fmtprint(fp, "%s.%s", s->pkg->name, s->name); |
516 case FTypeId: | 516 case FTypeId: |
517 if(fp->flags&FmtUnsigned) | 517 if(fp->flags&FmtUnsigned) |
518 return fmtprint(fp, "%s.%s", s->pkg->name, s->na
me); // dcommontype, typehash | 518 return fmtprint(fp, "%s.%s", s->pkg->name, s->na
me); // dcommontype, typehash |
519 return fmtprint(fp, "%s.%s", s->pkg->prefix, s->name);
// (methodsym), typesym, weaksym | 519 return fmtprint(fp, "%s.%s", s->pkg->prefix, s->name);
// (methodsym), typesym, weaksym |
520 case FExp: | 520 case FExp: |
| 521 if(s->name && s->name[0] == '.') |
| 522 fatal("exporting synthetic symbol %s", s->name); |
521 if(s->pkg != builtinpkg) | 523 if(s->pkg != builtinpkg) |
522 return fmtprint(fp, "@\"%Z\".%s", s->pkg->path,
s->name); | 524 return fmtprint(fp, "@\"%Z\".%s", s->pkg->path,
s->name); |
523 } | 525 } |
524 } | 526 } |
525 | 527 |
526 if(fp->flags&FmtByte) { // FmtByte (hh) implies FmtShort (h) | 528 if(fp->flags&FmtByte) { // FmtByte (hh) implies FmtShort (h) |
527 // skip leading "type." in method name | 529 // skip leading "type." in method name |
528 p = utfrrune(s->name, '.'); | 530 p = utfrrune(s->name, '.'); |
529 if(p) | 531 if(p) |
530 p++; | 532 p++; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 fmtprint(fp, " %lT;", t1); | 708 fmtprint(fp, " %lT;", t1); |
707 else | 709 else |
708 fmtprint(fp, " %lT ", t1); | 710 fmtprint(fp, " %lT ", t1); |
709 fmtstrcpy(fp, "}"); | 711 fmtstrcpy(fp, "}"); |
710 } | 712 } |
711 return 0; | 713 return 0; |
712 | 714 |
713 case TFIELD: | 715 case TFIELD: |
714 if(!(fp->flags&FmtShort)) { | 716 if(!(fp->flags&FmtShort)) { |
715 s = t->sym; | 717 s = t->sym; |
| 718 |
716 // Take the name from the original, lest we substituted
it with .anon%d | 719 // Take the name from the original, lest we substituted
it with .anon%d |
717 » » » if (t->nname && (fmtmode == FErr || fmtmode == FExp)) | 720 » » » if ((fmtmode == FErr || fmtmode == FExp) && t->nname !=
N) |
718 » » » » s = t->nname->orig->sym; | 721 » » » » if(t->nname->orig != N) |
| 722 » » » » » s = t->nname->orig->sym; |
| 723 » » » » else· |
| 724 » » » » » s = S; |
719 ························ | 725 ························ |
720 if(s != S && !t->embedded) { | 726 if(s != S && !t->embedded) { |
721 if(fp->flags&FmtLong) | 727 if(fp->flags&FmtLong) |
722 fmtprint(fp, "%hhS ", s); // qualify no
n-exported names (used on structs, not on funarg) | 728 fmtprint(fp, "%hhS ", s); // qualify no
n-exported names (used on structs, not on funarg) |
723 else· | 729 else· |
724 fmtprint(fp, "%S ", s); | 730 fmtprint(fp, "%S ", s); |
725 } else if(fmtmode == FExp) { | 731 } else if(fmtmode == FExp) { |
726 // TODO(rsc) this breaks on the eliding of unuse
d arguments in the backend | 732 // TODO(rsc) this breaks on the eliding of unuse
d arguments in the backend |
727 // when this is fixed, the special case in dcl.c
checkarglist can go. | 733 // when this is fixed, the special case in dcl.c
checkarglist can go. |
728 //if(t->funarg) | 734 //if(t->funarg) |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 dumplist(char *s, NodeList *l) | 1642 dumplist(char *s, NodeList *l) |
1637 { | 1643 { |
1638 print("%s\n%+H\n", s, l); | 1644 print("%s\n%+H\n", s, l); |
1639 } | 1645 } |
1640 | 1646 |
1641 void | 1647 void |
1642 dump(char *s, Node *n) | 1648 dump(char *s, Node *n) |
1643 { | 1649 { |
1644 print("%s [%p]\n%+N\n", s, n, n); | 1650 print("%s [%p]\n%+N\n", s, n, n); |
1645 } | 1651 } |
OLD | NEW |