Mercurial > projects > ddmd
diff 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 |
line wrap: on
line diff
--- a/dmd/Dsymbol.d Sat Aug 21 13:28:16 2010 +0400 +++ b/dmd/Dsymbol.d Sat Aug 21 14:16:53 2010 +0400 @@ -471,51 +471,45 @@ * Returns: * symbol found, null if not */ - Dsymbol searchX(Loc loc, Scope sc, Identifier id) + Dsymbol searchX(Loc loc, Scope sc, Object o) { //printf("Dsymbol::searchX(this=%p,%s, ident='%s')\n", this, toChars(), ident.toChars()); Dsymbol s = toAlias(); Dsymbol sm; - /// HUH???? - switch (id.dyncast()) + if (auto ident = cast(Identifier)o) + { + sm = s.search(loc, ident, 0); + } + else if (auto st = cast(Dsymbol)o) { - case DYNCAST.DYNCAST_IDENTIFIER: - sm = s.search(loc, id, 0); - break; - - case DYNCAST.DYNCAST_DSYMBOL: - { - assert(false); /// how can it happen? - // It's a template instance - //printf("\ttemplate instance id\n"); - Dsymbol st = cast(Dsymbol)id; - TemplateInstance ti = st.isTemplateInstance(); - id = ti.name; - sm = s.search(loc, id, 0); - if (!sm) - { - error("template identifier %s is not a member of %s %s", id.toChars(), s.kind(), s.toChars()); - return null; - } - sm = sm.toAlias(); - TemplateDeclaration td = sm.isTemplateDeclaration(); - if (!td) - { - error("%s is not a template, it is a %s", id.toChars(), sm.kind()); - return null; - } - - ti.tempdecl = td; - if (!ti.semanticRun) - ti.semantic(sc); - - sm = ti.toAlias(); - break; + // It's a template instance + //printf("\ttemplate instance id\n"); + TemplateInstance ti = st.isTemplateInstance(); + Identifier id = ti.name; + sm = s.search(loc, cast(Identifier)id, 0); + if (!sm) + { + error("template identifier %s is not a member of %s %s", id.toChars(), s.kind(), s.toChars()); + return null; + } + sm = sm.toAlias(); + TemplateDeclaration td = sm.isTemplateDeclaration(); + if (!td) + { + error("%s is not a template, it is a %s", id.toChars(), sm.kind()); + return null; } - default: - assert(0); + ti.tempdecl = td; + if (!ti.semanticRun) + ti.semantic(sc); + + sm = ti.toAlias(); + } + else + { + assert(0); } return sm; }