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; }
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; }
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; }