* @throws InternalError thrown if maximum AST depth is exceeded */
| 689 | * @throws InternalError thrown if maximum AST depth is exceeded |
| 690 | */ |
| 691 | static void compileUnaryOp(Token *&tok, AST_state& state, void (*f)(Token *&tok, AST_state& state)) |
| 692 | { |
| 693 | Token *unaryop = tok; |
| 694 | if (f) { |
| 695 | tok = tok->next(); |
| 696 | state.depth++; |
| 697 | if (state.depth > AST_MAX_DEPTH) |
| 698 | throw InternalError(tok, "maximum AST depth exceeded", InternalError::AST); |
| 699 | if (tok) |
| 700 | f(tok, state); |
| 701 | state.depth--; |
| 702 | } |
| 703 | |
| 704 | if (!state.op.empty() && (!precedes(state.op.top(), unaryop) || unaryop->isIncDecOp() || Token::Match(unaryop, "[({[]"))) { // nullary functions, empty lists/arrays |
| 705 | unaryop->astOperand1(state.op.top()); |
| 706 | state.op.pop(); |
| 707 | } |
| 708 | state.op.push(unaryop); |
| 709 | } |
| 710 | |
| 711 | static void skipGenericType(Token *&tok) |
| 712 | { |
no test coverage detected