Changeset 205
- Timestamp:
- 10/13/09 09:49:25 (2 years ago)
- Files:
-
- branches/dmd-1.x/src/dsymbol.c (modified) (2 diffs)
- branches/dmd-1.x/src/dsymbol.h (modified) (1 diff)
- branches/dmd-1.x/src/mars.c (modified) (1 diff)
- branches/dmd-1.x/src/module.c (modified) (6 diffs)
- branches/dmd-1.x/src/module.h (modified) (3 diffs)
- branches/dmd-1.x/src/scope.c (modified) (1 diff)
- branches/dmd-1.x/src/typinf.c (modified) (2 diffs)
- trunk/src/dsymbol.c (modified) (6 diffs)
- trunk/src/dsymbol.h (modified) (1 diff)
- trunk/src/mars.c (modified) (1 diff)
- trunk/src/module.c (modified) (3 diffs)
- trunk/src/module.h (modified) (1 diff)
- trunk/src/scope.c (modified) (1 diff)
- trunk/src/typinf.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dmd-1.x/src/dsymbol.c
r203 r205 477 477 if (!isAnonymous()) // no name, so can't add it to symbol table 478 478 { 479 if (!sd->symtab ->insert(this)) // if name is already defined479 if (!sd->symtabInsert(this)) // if name is already defined 480 480 { 481 481 Dsymbol *s2; … … 870 870 } 871 871 872 Dsymbol *ScopeDsymbol::symtabInsert(Dsymbol *s) 873 { 874 return symtab->insert(s); 875 } 876 877 /*************************************** 878 * Determine number of Dsymbols, folding in AttribDeclaration members. 879 */ 880 881 #if DMDV2 882 size_t ScopeDsymbol::dim(Array *members) 883 { 884 size_t n = 0; 885 if (members) 886 { 887 for (size_t i = 0; i < members->dim; i++) 888 { Dsymbol *s = (Dsymbol *)members->data[i]; 889 AttribDeclaration *a = s->isAttribDeclaration(); 890 891 if (a) 892 { 893 n += dim(a->decl); 894 } 895 else 896 n++; 897 } 898 } 899 return n; 900 } 901 #endif 902 903 /*************************************** 904 * Get nth Dsymbol, folding in AttribDeclaration members. 905 * Returns: 906 * Dsymbol* nth Dsymbol 907 * NULL not found, *pn gets incremented by the number 908 * of Dsymbols 909 */ 910 911 #if DMDV2 912 Dsymbol *ScopeDsymbol::getNth(Array *members, size_t nth, size_t *pn) 913 { 914 if (!members) 915 return NULL; 916 917 size_t n = 0; 918 for (size_t i = 0; i < members->dim; i++) 919 { Dsymbol *s = (Dsymbol *)members->data[i]; 920 AttribDeclaration *a = s->isAttribDeclaration(); 921 922 if (a) 923 { 924 s = getNth(a->decl, nth - n, &n); 925 if (s) 926 return s; 927 } 928 else if (n == nth) 929 return s; 930 else 931 n++; 932 } 933 934 if (pn) 935 *pn += n; 936 return NULL; 937 } 938 #endif 872 939 873 940 /******************************************* branches/dmd-1.x/src/dsymbol.h
r204 r205 250 250 const char *kind(); 251 251 FuncDeclaration *findGetMembers(); 252 virtual Dsymbol *symtabInsert(Dsymbol *s); 252 253 253 254 void emitMemberComments(Scope *sc); branches/dmd-1.x/src/mars.c
r204 r205 81 81 #endif 82 82 ; 83 version = "v1.0 49";83 version = "v1.050"; 84 84 global.structalign = 8; 85 85 branches/dmd-1.x/src/module.c
r203 r205 110 110 macrotable = NULL; 111 111 escapetable = NULL; 112 safe = FALSE; 112 113 doppelganger = 0; 113 114 cov = NULL; … … 810 811 811 812 void Module::inlineScan() 812 { int i; 813 813 { 814 814 if (semanticstarted >= 4) 815 815 return; … … 822 822 //printf("Module = %p\n", sc.scopesym); 823 823 824 for (i = 0; i < members->dim; i++) 825 { Dsymbol *s; 826 827 s = (Dsymbol *)members->data[i]; 824 for (int i = 0; i < members->dim; i++) 825 { Dsymbol *s = (Dsymbol *)members->data[i]; 828 826 //if (global.params.verbose) 829 827 //printf("inline scan symbol %s\n", s->toChars()); … … 874 872 /* Since modules can be circularly referenced, 875 873 * need to stop infinite recursive searches. 874 * This is done with the cache. 876 875 */ 877 876 … … 880 879 if (insearch) 881 880 s = NULL; 882 else if (searchCacheIdent == ident && searchCacheFlags == flags && searchCacheSymbol)881 else if (searchCacheIdent == ident && searchCacheFlags == flags) 883 882 { 884 883 s = searchCacheSymbol; … … 897 896 return s; 898 897 } 898 899 Dsymbol *Module::symtabInsert(Dsymbol *s) 900 { 901 searchCacheIdent = 0; // symbol is inserted, so invalidate cache 902 return Package::symtabInsert(s); 903 } 904 899 905 900 906 /******************************************* branches/dmd-1.x/src/module.h
r204 r205 107 107 Macro *macrotable; // document comment macros 108 108 Escape *escapetable; // document comment escapes 109 bool safe; // TRUE if module is marked as 'safe' 109 110 110 111 Module(char *arg, Identifier *ident, int doDocComment, int doHdrGen); … … 137 138 int needModuleInfo(); 138 139 Dsymbol *search(Loc loc, Identifier *ident, int flags); 140 Dsymbol *symtabInsert(Dsymbol *s); 139 141 void deleteObjFile(); 140 142 void addDeferredSemantic(Dsymbol *s); … … 177 179 Identifier *id; 178 180 Array *packages; // array of Identifier's representing packages 181 bool safe; 179 182 180 183 ModuleDeclaration(Array *packages, Identifier *id); branches/dmd-1.x/src/scope.c
r190 r205 283 283 if (!sc->scopesym->symtab) 284 284 sc->scopesym->symtab = new DsymbolTable(); 285 return sc->scopesym->symtab ->insert(s);285 return sc->scopesym->symtabInsert(s); 286 286 } 287 287 } branches/dmd-1.x/src/typinf.c
r196 r205 428 428 TypeDelegate *tc = (TypeDelegate *)tinfo; 429 429 430 tc->next->next ->getTypeInfo(NULL);431 dtxoff(pdt, tc->next->next ->vtinfo->toSymbol(), 0, TYnptr); // TypeInfo for delegate return value430 tc->next->nextOf()->getTypeInfo(NULL); 431 dtxoff(pdt, tc->next->nextOf()->vtinfo->toSymbol(), 0, TYnptr); // TypeInfo for delegate return value 432 432 } 433 433 … … 847 847 v = new VarDeclaration(0, t, id, ai); 848 848 m->members->push(v); 849 m->symtab ->insert(v);849 m->symtabInsert(v); 850 850 sc = sc->push(); 851 851 sc->linkage = LINKc; trunk/src/dsymbol.c
r203 r205 477 477 if (!isAnonymous()) // no name, so can't add it to symbol table 478 478 { 479 if (!sd->symtab ->insert(this)) // if name is already defined479 if (!sd->symtabInsert(this)) // if name is already defined 480 480 { 481 481 Dsymbol *s2; … … 908 908 } 909 909 910 Dsymbol *ScopeDsymbol::symtabInsert(Dsymbol *s) 911 { 912 return symtab->insert(s); 913 } 910 914 911 915 /*************************************** … … 913 917 */ 914 918 919 #if DMDV2 915 920 size_t ScopeDsymbol::dim(Array *members) 916 921 { … … 932 937 return n; 933 938 } 939 #endif 934 940 935 941 /*************************************** … … 941 947 */ 942 948 949 #if DMDV2 943 950 Dsymbol *ScopeDsymbol::getNth(Array *members, size_t nth, size_t *pn) 944 951 { … … 967 974 return NULL; 968 975 } 976 #endif 969 977 970 978 /******************************************* trunk/src/dsymbol.h
r204 r205 250 250 const char *kind(); 251 251 FuncDeclaration *findGetMembers(); 252 virtual Dsymbol *symtabInsert(Dsymbol *s); 252 253 253 254 void emitMemberComments(Scope *sc); trunk/src/mars.c
r204 r205 81 81 #endif 82 82 ; 83 version = "v2.03 5";83 version = "v2.036"; 84 84 global.structalign = 8; 85 85 trunk/src/module.c
r204 r205 876 876 /* Since modules can be circularly referenced, 877 877 * need to stop infinite recursive searches. 878 * This is done with the cache. 878 879 */ 879 880 … … 882 883 if (insearch) 883 884 s = NULL; 884 else if (searchCacheIdent == ident && searchCacheFlags == flags && searchCacheSymbol)885 else if (searchCacheIdent == ident && searchCacheFlags == flags) 885 886 { 886 887 s = searchCacheSymbol; … … 899 900 return s; 900 901 } 902 903 Dsymbol *Module::symtabInsert(Dsymbol *s) 904 { 905 searchCacheIdent = 0; // symbol is inserted, so invalidate cache 906 return Package::symtabInsert(s); 907 } 908 901 909 902 910 /******************************************* trunk/src/module.h
r204 r205 138 138 int needModuleInfo(); 139 139 Dsymbol *search(Loc loc, Identifier *ident, int flags); 140 Dsymbol *symtabInsert(Dsymbol *s); 140 141 void deleteObjFile(); 141 142 void addDeferredSemantic(Dsymbol *s); trunk/src/scope.c
r192 r205 283 283 if (!sc->scopesym->symtab) 284 284 sc->scopesym->symtab = new DsymbolTable(); 285 return sc->scopesym->symtab ->insert(s);285 return sc->scopesym->symtabInsert(s); 286 286 } 287 287 } trunk/src/typinf.c
r195 r205 880 880 v = new VarDeclaration(0, t, id, ai); 881 881 m->members->push(v); 882 m->symtab ->insert(v);882 m->symtabInsert(v); 883 883 sc = sc->push(); 884 884 sc->linkage = LINKc;
