| 7429 | } |
| 7430 | |
| 7431 | static ValueType::Type getEnumType(const Scope* scope, const Platform& platform) // TODO: also determine sign? |
| 7432 | { |
| 7433 | ValueType::Type type = ValueType::Type::INT; |
| 7434 | for (const Token* tok = scope->bodyStart; tok && tok != scope->bodyEnd; tok = tok->next()) { |
| 7435 | if (const Token* lam = findLambdaEndToken(tok)) { |
| 7436 | tok = lam; |
| 7437 | continue; |
| 7438 | } |
| 7439 | if (!tok->isAssignmentOp()) |
| 7440 | continue; |
| 7441 | const Token* vTok = tok->astOperand2(); |
| 7442 | if (!vTok->hasKnownIntValue()) { |
| 7443 | if (!vTok->isLiteral()) |
| 7444 | continue; |
| 7445 | if (const ValueType* vt = vTok->valueType()) { |
| 7446 | if ((vt->type > type && (vt->type == ValueType::Type::LONG || vt->type == ValueType::Type::LONGLONG))) |
| 7447 | type = vt->type; |
| 7448 | } |
| 7449 | continue; |
| 7450 | } |
| 7451 | const MathLib::bigint value = vTok->getKnownIntValue(); |
| 7452 | if (!platform.isIntValue(value)) { |
| 7453 | type = ValueType::Type::LONG; |
| 7454 | if (!platform.isLongValue(value)) |
| 7455 | type = ValueType::Type::LONGLONG; |
| 7456 | } |
| 7457 | } |
| 7458 | return type; |
| 7459 | } |
| 7460 | |
| 7461 | static const Token* parsedecl(const Token* type, |
| 7462 | ValueType* const valuetype, |
no test coverage detected