Пример #1
0
void UserAttributeDeclaration::semantic2(Scope *sc)
{
    if (decl)
    {
        Scope *newsc = sc;
        if (atts && atts->dim)
        {
            if (scope)
            {
                scope = NULL;
                arrayExpressionSemantic(atts, sc);  // run semantic
            }

            // create new one for changes
            newsc = sc->push();
            newsc->userAttribDecl = this;
        }
        for (size_t i = 0; i < decl->dim; i++)
        {
            Dsymbol *s = (*decl)[i];
            s->semantic2(newsc);
        }
        if (newsc != sc)
        {
            sc->offset = newsc->offset;
            newsc->pop();
        }
    }
}
Пример #2
0
void UserAttributeDeclaration::semantic(Scope *sc)
{
    //printf("UserAttributeDeclaration::semantic() %p\n", this);
    atts = arrayExpressionSemantic(atts, sc);

    if (decl)
    {
        Scope *newsc = sc;
#if 1
        if (atts && atts->dim)
        {
            // create new one for changes
            newsc = new Scope(*sc);
            newsc->flags &= ~SCOPEfree;

            // Create new uda that is the concatenation of the previous
            newsc->userAttributes = concat(newsc->userAttributes, atts);
        }
#endif
        for (size_t i = 0; i < decl->dim; i++)
        {   Dsymbol *s = (*decl)[i];

            s->semantic(newsc);
        }
        if (newsc != sc)
        {
            sc->offset = newsc->offset;
            newsc->pop();
        }
    }
}
Пример #3
0
void UserAttributeDeclaration::semantic2(Scope *sc)
{
    if (decl && atts && atts->dim)
    {
        if (atts && atts->dim && scope)
        {
            scope = NULL;
            arrayExpressionSemantic(atts, sc);  // run semantic
        }
    }

    AttribDeclaration::semantic2(sc);
}
Пример #4
0
Expressions *UserAttributeDeclaration::getAttributes()
{
    if (scope)
    {
        Scope *sc = scope;
        scope = NULL;
        arrayExpressionSemantic(atts, sc);
    }

    Expressions *exps = new Expressions();
    if (userAttribDecl)
        exps->push(new TupleExp(Loc(), userAttribDecl->getAttributes()));
    if (atts && atts->dim)
        exps->push(new TupleExp(Loc(), atts));

    return exps;
}