示例#1
0
文件: arrayop.c 项目: hariomrana/dmd
bool isNonAssignmentArrayOp(Expression *e)
{
    if (e->op == TOKslice)
        return isNonAssignmentArrayOp(((SliceExp *)e)->e1);
    Type *tb = e->type->toBasetype();

    if (tb->ty == Tarray || tb->ty == Tsarray)
    {
        switch (e->op)
        {
            case TOKadd:
            case TOKmin:
            case TOKmul:
            case TOKdiv:
            case TOKmod:
            case TOKxor:
            case TOKand:
            case TOKor:
            case TOKpow:
            case TOKneg:
            case TOKtilde:
                return true;

            default:
                return false;
        }
    }
    return false;
}
示例#2
0
文件: arrayop.c 项目: Lucretia/gcc
bool checkNonAssignmentArrayOp(Expression *e, bool suggestion)
{
    if (isNonAssignmentArrayOp(e))
    {
        const char *s = "";
        if (suggestion)
            s = " (possible missing [])";
        e->error("array operation %s without destination memory not allowed%s", e->toChars(), s);
        return true;
    }
    return false;
}
示例#3
0
文件: arrayop.c 项目: Lucretia/gcc
bool isNonAssignmentArrayOp(Expression *e)
{
    if (e->op == TOKslice)
        return isNonAssignmentArrayOp(((SliceExp *)e)->e1);

    Type *tb = e->type->toBasetype();
    if (tb->ty == Tarray || tb->ty == Tsarray)
    {
        return (isUnaArrayOp(e->op) || isBinArrayOp(e->op));
    }
    return false;
}