Changeset 626:e83ba4ae4878
- Timestamp:
- 10/01/08 13:16:10
(3 months ago)
- Author:
- Christian Kamm <kamm incasoftware de>
- branch:
- default
- Message:
Fix import visibility bugs 313 and 314.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r443 |
r626 |
|
| 647 | 647 | // Look in symbols declared in this module |
|---|
| 648 | 648 | Dsymbol *s = symtab ? symtab->lookup(ident) : NULL; |
|---|
| | 649 | |
|---|
| | 650 | // hide private nonlocal symbols |
|---|
| | 651 | if (flags & 1 && s && s->prot() == PROTprivate) |
|---|
| | 652 | s = NULL; |
|---|
| | 653 | |
|---|
| 649 | 654 | if (s) |
|---|
| 650 | 655 | { |
|---|
| r336 |
r626 |
|
| 34 | 34 | this->aliasId = aliasId; |
|---|
| 35 | 35 | this->isstatic = isstatic; |
|---|
| | 36 | protection = PROTundefined; |
|---|
| 36 | 37 | pkg = NULL; |
|---|
| 37 | 38 | mod = NULL; |
|---|
| … | … | |
| 61 | 62 | } |
|---|
| 62 | 63 | |
|---|
| | 64 | enum PROT Import::prot() |
|---|
| | 65 | { |
|---|
| | 66 | return protection; |
|---|
| | 67 | } |
|---|
| 63 | 68 | |
|---|
| 64 | 69 | Dsymbol *Import::syntaxCopy(Dsymbol *s) |
|---|
| … | … | |
| 132 | 137 | #endif |
|---|
| 133 | 138 | |
|---|
| | 139 | /* Default to private importing |
|---|
| | 140 | */ |
|---|
| | 141 | protection = sc->protection; |
|---|
| | 142 | if (!sc->explicitProtection) |
|---|
| | 143 | protection = PROTprivate; |
|---|
| | 144 | |
|---|
| 134 | 145 | if (!isstatic && !aliasId && !names.dim) |
|---|
| 135 | 146 | { |
|---|
| 136 | | /* Default to private importing |
|---|
| 137 | | */ |
|---|
| 138 | | enum PROT prot = sc->protection; |
|---|
| 139 | | if (!sc->explicitProtection) |
|---|
| 140 | | prot = PROTprivate; |
|---|
| 141 | | sc->scopesym->importScope(mod, prot); |
|---|
| | 147 | sc->scopesym->importScope(mod, protection); |
|---|
| 142 | 148 | } |
|---|
| 143 | 149 | |
|---|
| … | … | |
| 150 | 156 | sc = sc->push(mod); |
|---|
| 151 | 157 | for (size_t i = 0; i < aliasdecls.dim; i++) |
|---|
| 152 | | { Dsymbol *s = (Dsymbol *)aliasdecls.data[i]; |
|---|
| | 158 | { AliasDeclaration *ad = (AliasDeclaration *)aliasdecls.data[i]; |
|---|
| 153 | 159 | |
|---|
| 154 | 160 | //printf("\tImport alias semantic('%s')\n", s->toChars()); |
|---|
| … | … | |
| 156 | 162 | error("%s not found", ((Identifier *)names.data[i])->toChars()); |
|---|
| 157 | 163 | |
|---|
| 158 | | s->semantic(sc); |
|---|
| | 164 | ad->semantic(sc); |
|---|
| | 165 | ad->protection = protection; |
|---|
| 159 | 166 | } |
|---|
| 160 | 167 | sc = sc->pop(); |
|---|
| r336 |
r626 |
|
| 35 | 35 | Identifier *aliasId; |
|---|
| 36 | 36 | int isstatic; // !=0 if static import |
|---|
| | 37 | enum PROT protection; |
|---|
| 37 | 38 | |
|---|
| 38 | 39 | // Pairs of alias=name to bind into current namespace |
|---|
| … | … | |
| 50 | 51 | |
|---|
| 51 | 52 | const char *kind(); |
|---|
| | 53 | enum PROT prot(); |
|---|
| 52 | 54 | Dsymbol *syntaxCopy(Dsymbol *s); // copy only syntax trees |
|---|
| 53 | 55 | void load(Scope *sc); |
|---|
| r622 |
r626 |
|
| 65 | 65 | LOG_SCOPE; |
|---|
| 66 | 66 | |
|---|
| 67 | | printf("codegen: %s\n", srcfile->toChars()); |
|---|
| | 67 | // printf("codegen: %s\n", srcfile->toChars()); |
|---|
| 68 | 68 | |
|---|
| 69 | 69 | // start by deleting the old object file |
|---|