Exemple #1
0
Dsymbol *WithScopeSymbol::search(Loc loc, Identifier *ident, int flags)
{
    // Acts as proxy to the with class declaration
    Dsymbol *s = NULL;
    Expression *eold = NULL;
    for (Expression *e = withstate->exp; e != eold; e = resolveAliasThis(scope, e))
    {
        if (e->op == TOKimport)
        {
            s = ((ScopeExp *)e)->sds;
        }
        else if (e->op == TOKtype)
        {
            s = e->type->toDsymbol(NULL);
        }
        else
        {
            Type *t = e->type->toBasetype();
            s = t->toDsymbol(NULL);
        }
        if (s)
        {
            s = s->search(loc, ident);
            if (s)
                return s;
        }
        eold = e;
    }
    return NULL;
}
Exemple #2
0
Dsymbol *WithScopeSymbol::search(Loc loc, Identifier *ident, int flags)
{
    // Acts as proxy to the with class declaration
    Dsymbol *s = NULL;
    Expression *eold = NULL;
    for (Expression *e = withstate->exp; e != eold; e = resolveAliasThis(scope, e))
    {
        Type *t = e->type->toBasetype();
        if (t->ty == Taarray)
            s = ((TypeAArray *)t)->getImpl();
        else
            s = t->toDsymbol(NULL);
        if (s)
        {
            s = s->search(loc, ident, 0);
            if (s)
                return s;
        }
        eold = e;
    }
    return NULL;
}