comparison dmd/Dsymbol.d @ 56:51605de93870

TupleExp.optimize UnrolledLoopStatement.ctor UnrolledLoopStatement.semantic UnrolledLoopStatement.blockExit OrOrExp.checkSideEffect FuncExp.syntaxCopy FuncLiteralDeclaration.syntaxCopy WhileStatement.hasBreak StructInitializer.toExpression StructLiteralExp.ctor StructLiteralExp.optimize BinExp.commonSemanticAssign ModAssignExp.opId Argument.isLazyArray CommaExp.implicitConvTo CommaExp.castTo TypeClass.isBaseOf createTypeInfoArray TypeTuple.getTypeInfoDeclaration TypeInfoTupleDeclaration.ctor TypeNext.constConv XorExp.implicitConvTo TemplateParameter.isTemplateValueParameter
author korDen
date Sat, 21 Aug 2010 14:16:53 +0400
parents adf6f7f216ea
children ecf732dfe11e
comparison
equal deleted inserted replaced
55:8c2c7b7579f8 56:51605de93870
469 * Search for identifier id as a member of 'this'. 469 * Search for identifier id as a member of 'this'.
470 * id may be a template instance. 470 * id may be a template instance.
471 * Returns: 471 * Returns:
472 * symbol found, null if not 472 * symbol found, null if not
473 */ 473 */
474 Dsymbol searchX(Loc loc, Scope sc, Identifier id) 474 Dsymbol searchX(Loc loc, Scope sc, Object o)
475 { 475 {
476 //printf("Dsymbol::searchX(this=%p,%s, ident='%s')\n", this, toChars(), ident.toChars()); 476 //printf("Dsymbol::searchX(this=%p,%s, ident='%s')\n", this, toChars(), ident.toChars());
477 Dsymbol s = toAlias(); 477 Dsymbol s = toAlias();
478 Dsymbol sm; 478 Dsymbol sm;
479 479
480 /// HUH???? 480 if (auto ident = cast(Identifier)o)
481 switch (id.dyncast()) 481 {
482 { 482 sm = s.search(loc, ident, 0);
483 case DYNCAST.DYNCAST_IDENTIFIER: 483 }
484 sm = s.search(loc, id, 0); 484 else if (auto st = cast(Dsymbol)o)
485 break; 485 {
486 486 // It's a template instance
487 case DYNCAST.DYNCAST_DSYMBOL: 487 //printf("\ttemplate instance id\n");
488 { 488 TemplateInstance ti = st.isTemplateInstance();
489 assert(false); /// how can it happen? 489 Identifier id = ti.name;
490 // It's a template instance 490 sm = s.search(loc, cast(Identifier)id, 0);
491 //printf("\ttemplate instance id\n"); 491 if (!sm)
492 Dsymbol st = cast(Dsymbol)id; 492 {
493 TemplateInstance ti = st.isTemplateInstance(); 493 error("template identifier %s is not a member of %s %s", id.toChars(), s.kind(), s.toChars());
494 id = ti.name; 494 return null;
495 sm = s.search(loc, id, 0); 495 }
496 if (!sm) 496 sm = sm.toAlias();
497 { 497 TemplateDeclaration td = sm.isTemplateDeclaration();
498 error("template identifier %s is not a member of %s %s", id.toChars(), s.kind(), s.toChars()); 498 if (!td)
499 return null; 499 {
500 } 500 error("%s is not a template, it is a %s", id.toChars(), sm.kind());
501 sm = sm.toAlias(); 501 return null;
502 TemplateDeclaration td = sm.isTemplateDeclaration(); 502 }
503 if (!td) 503
504 { 504 ti.tempdecl = td;
505 error("%s is not a template, it is a %s", id.toChars(), sm.kind()); 505 if (!ti.semanticRun)
506 return null; 506 ti.semantic(sc);
507 } 507
508 508 sm = ti.toAlias();
509 ti.tempdecl = td; 509 }
510 if (!ti.semanticRun) 510 else
511 ti.semantic(sc); 511 {
512 512 assert(0);
513 sm = ti.toAlias();
514 break;
515 }
516
517 default:
518 assert(0);
519 } 513 }
520 return sm; 514 return sm;
521 } 515 }
522 516
523 bool overloadInsert(Dsymbol s) 517 bool overloadInsert(Dsymbol s)