| 2388 | } |
| 2389 | |
| 2390 | void GDScriptAnalyzer::resolve_assert(GDScriptParser::AssertNode *p_assert) { |
| 2391 | reduce_expression(p_assert->condition); |
| 2392 | if (p_assert->message != nullptr) { |
| 2393 | reduce_expression(p_assert->message); |
| 2394 | if (!p_assert->message->get_datatype().has_no_type() && (p_assert->message->get_datatype().kind != GDScriptParser::DataType::BUILTIN || p_assert->message->get_datatype().builtin_type != Variant::STRING)) { |
| 2395 | push_error(R"(Expected string for assert error message.)", p_assert->message); |
| 2396 | } |
| 2397 | } |
| 2398 | |
| 2399 | p_assert->set_datatype(p_assert->condition->get_datatype()); |
| 2400 | |
| 2401 | #ifdef DEBUG_ENABLED |
| 2402 | if (p_assert->condition->is_constant) { |
| 2403 | if (p_assert->condition->reduced_value.booleanize()) { |
| 2404 | parser->push_warning(p_assert->condition, GDScriptWarning::ASSERT_ALWAYS_TRUE); |
| 2405 | } else if (!(p_assert->condition->type == GDScriptParser::Node::LITERAL && static_cast<GDScriptParser::LiteralNode *>(p_assert->condition)->value.get_type() == Variant::BOOL)) { |
| 2406 | parser->push_warning(p_assert->condition, GDScriptWarning::ASSERT_ALWAYS_FALSE); |
| 2407 | } |
| 2408 | } |
| 2409 | #endif // DEBUG_ENABLED |
| 2410 | } |
| 2411 | |
| 2412 | void GDScriptAnalyzer::resolve_match(GDScriptParser::MatchNode *p_match) { |
| 2413 | reduce_expression(p_match->test); |
nothing calls this directly
no test coverage detected