Changeset 404
- Timestamp:
- 03/02/10 20:38:55 (15 years ago)
- Files:
-
- branches/dmd-1.x/src/expression.c (modified) (1 diff)
- trunk/src/expression.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dmd-1.x/src/expression.c
r396 r404 5915 5915 5916 5916 Expression *DotTemplateInstanceExp::semantic(Scope *sc) 5917 5917 { 5918 5918 #if 1 5919 5919 #if LOGSEMANTIC 5920 5920 printf("DotTemplateInstanceExp::semantic('%s')\n", toChars()); 5921 5921 #endif 5922 5922 Expression *eleft; 5923 5923 Expression *e = new DotIdExp(loc, e1, ti->name); 5924 5924 L1: 5925 5925 e = e->semantic(sc); 5926 5926 if (e->op == TOKdottd) 5927 5927 { 5928 5928 if (global.errors) 5929 5929 return new ErrorExp(); // TemplateInstance::semantic() will fail anyway 5930 5930 DotTemplateExp *dte = (DotTemplateExp *)e; 5931 5931 TemplateDeclaration *td = dte->td; 5932 5932 eleft = dte->e1; 5933 5933 ti->tempdecl = td; 5934 5934 ti->semantic(sc); 5935 if (!ti->inst) // if template failed to expand 5936 return new ErrorExp(); 5935 5937 Dsymbol *s = ti->inst->toAlias(); 5936 5938 Declaration *v = s->isDeclaration(); 5937 5939 if (v) 5938 5940 { e = new DotVarExp(loc, eleft, v); 5939 5941 e = e->semantic(sc); 5940 5942 return e; 5941 5943 } 5942 5944 e = new ScopeExp(loc, ti); 5943 5945 e = new DotExp(loc, eleft, e); 5944 5946 e = e->semantic(sc); 5945 5947 return e; 5946 5948 } 5947 5949 else if (e->op == TOKimport) 5948 5950 { ScopeExp *se = (ScopeExp *)e; 5949 5951 TemplateDeclaration *td = se->sds->isTemplateDeclaration(); 5950 5952 if (!td) 5951 5953 { error("%s is not a template", e->toChars()); 5952 5954 return new ErrorExp(); 5953 5955 } 5954 5956 ti->tempdecl = td; trunk/src/expression.c
r403 r404 6271 6271 } 6272 6272 6273 6273 Expression *DotTemplateInstanceExp::semantic(Scope *sc) 6274 6274 { 6275 6275 #if LOGSEMANTIC 6276 6276 printf("DotTemplateInstanceExp::semantic('%s')\n", toChars()); 6277 6277 #endif 6278 6278 Expression *eleft; 6279 6279 Expression *e = new DotIdExp(loc, e1, ti->name); 6280 6280 L1: 6281 6281 e = e->semantic(sc); 6282 6282 if (e->op == TOKdottd) 6283 6283 { 6284 6284 if (global.errors) 6285 6285 return new ErrorExp(); // TemplateInstance::semantic() will fail anyway 6286 6286 DotTemplateExp *dte = (DotTemplateExp *)e; 6287 6287 TemplateDeclaration *td = dte->td; 6288 6288 eleft = dte->e1; 6289 6289 ti->tempdecl = td; 6290 6290 ti->semantic(sc); 6291 if (!ti->inst) // if template failed to expand 6292 return new ErrorExp(); 6291 6293 Dsymbol *s = ti->inst->toAlias(); 6292 6294 Declaration *v = s->isDeclaration(); 6293 6295 if (v) 6294 6296 { e = new DotVarExp(loc, eleft, v); 6295 6297 e = e->semantic(sc); 6296 6298 return e; 6297 6299 } 6298 6300 e = new ScopeExp(loc, ti); 6299 6301 e = new DotExp(loc, eleft, e); 6300 6302 e = e->semantic(sc); 6301 6303 return e; 6302 6304 } 6303 6305 else if (e->op == TOKimport) 6304 6306 { ScopeExp *se = (ScopeExp *)e; 6305 6307 TemplateDeclaration *td = se->sds->isTemplateDeclaration(); 6306 6308 if (!td) 6307 6309 { error("%s is not a template", e->toChars()); 6308 6310 return new ErrorExp(); 6309 6311 } 6310 6312 ti->tempdecl = td;
