| 1539 | } |
| 1540 | |
| 1541 | bool Token::isCalculation() const |
| 1542 | { |
| 1543 | if (!Token::Match(this, "%cop%|++|--")) |
| 1544 | return false; |
| 1545 | |
| 1546 | if (Token::Match(this, "*|&")) { |
| 1547 | // dereference or address-of? |
| 1548 | if (!this->astOperand2()) |
| 1549 | return false; |
| 1550 | |
| 1551 | if (this->astOperand2()->str() == "[") |
| 1552 | return false; |
| 1553 | |
| 1554 | // type specification? |
| 1555 | std::stack<const Token *> operands; |
| 1556 | operands.push(this); |
| 1557 | while (!operands.empty()) { |
| 1558 | const Token *op = operands.top(); |
| 1559 | operands.pop(); |
| 1560 | if (op->isNumber() || op->varId() > 0) |
| 1561 | return true; |
| 1562 | if (op->astOperand1()) |
| 1563 | operands.push(op->astOperand1()); |
| 1564 | if (op->astOperand2()) |
| 1565 | operands.push(op->astOperand2()); |
| 1566 | else if (Token::Match(op, "*|&")) |
| 1567 | return false; |
| 1568 | } |
| 1569 | |
| 1570 | // type specification => return false |
| 1571 | return false; |
| 1572 | } |
| 1573 | |
| 1574 | return true; |
| 1575 | } |
| 1576 | |
| 1577 | bool Token::isUnaryPreOp() const |
| 1578 | { |
no test coverage detected