Merge pull request #71120 from jordigcs/ternary
Closes https://github.com/godotengine/godot/issues/71065
This commit is contained in:
commit
e93266b9ff
|
@ -2012,7 +2012,7 @@ void GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode *p_expre
|
||||||
reduce_subscript(static_cast<GDScriptParser::SubscriptNode *>(p_expression));
|
reduce_subscript(static_cast<GDScriptParser::SubscriptNode *>(p_expression));
|
||||||
break;
|
break;
|
||||||
case GDScriptParser::Node::TERNARY_OPERATOR:
|
case GDScriptParser::Node::TERNARY_OPERATOR:
|
||||||
reduce_ternary_op(static_cast<GDScriptParser::TernaryOpNode *>(p_expression));
|
reduce_ternary_op(static_cast<GDScriptParser::TernaryOpNode *>(p_expression), p_is_root);
|
||||||
break;
|
break;
|
||||||
case GDScriptParser::Node::UNARY_OPERATOR:
|
case GDScriptParser::Node::UNARY_OPERATOR:
|
||||||
reduce_unary_op(static_cast<GDScriptParser::UnaryOpNode *>(p_expression));
|
reduce_unary_op(static_cast<GDScriptParser::UnaryOpNode *>(p_expression));
|
||||||
|
@ -3733,10 +3733,10 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
|
||||||
p_subscript->set_datatype(result_type);
|
p_subscript->set_datatype(result_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GDScriptAnalyzer::reduce_ternary_op(GDScriptParser::TernaryOpNode *p_ternary_op) {
|
void GDScriptAnalyzer::reduce_ternary_op(GDScriptParser::TernaryOpNode *p_ternary_op, bool p_is_root) {
|
||||||
reduce_expression(p_ternary_op->condition);
|
reduce_expression(p_ternary_op->condition);
|
||||||
reduce_expression(p_ternary_op->true_expr);
|
reduce_expression(p_ternary_op->true_expr, p_is_root);
|
||||||
reduce_expression(p_ternary_op->false_expr);
|
reduce_expression(p_ternary_op->false_expr, p_is_root);
|
||||||
|
|
||||||
GDScriptParser::DataType result;
|
GDScriptParser::DataType result;
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ class GDScriptAnalyzer {
|
||||||
void reduce_preload(GDScriptParser::PreloadNode *p_preload);
|
void reduce_preload(GDScriptParser::PreloadNode *p_preload);
|
||||||
void reduce_self(GDScriptParser::SelfNode *p_self);
|
void reduce_self(GDScriptParser::SelfNode *p_self);
|
||||||
void reduce_subscript(GDScriptParser::SubscriptNode *p_subscript);
|
void reduce_subscript(GDScriptParser::SubscriptNode *p_subscript);
|
||||||
void reduce_ternary_op(GDScriptParser::TernaryOpNode *p_ternary_op);
|
void reduce_ternary_op(GDScriptParser::TernaryOpNode *p_ternary_op, bool p_is_root = false);
|
||||||
void reduce_unary_op(GDScriptParser::UnaryOpNode *p_unary_op);
|
void reduce_unary_op(GDScriptParser::UnaryOpNode *p_unary_op);
|
||||||
|
|
||||||
void const_fold_array(GDScriptParser::ArrayNode *p_array, bool p_is_const);
|
void const_fold_array(GDScriptParser::ArrayNode *p_array, bool p_is_const);
|
||||||
|
|
|
@ -1701,6 +1701,7 @@ GDScriptParser::Node *GDScriptParser::parse_statement() {
|
||||||
case Node::CALL:
|
case Node::CALL:
|
||||||
case Node::ASSIGNMENT:
|
case Node::ASSIGNMENT:
|
||||||
case Node::AWAIT:
|
case Node::AWAIT:
|
||||||
|
case Node::TERNARY_OPERATOR:
|
||||||
// Fine.
|
// Fine.
|
||||||
break;
|
break;
|
||||||
case Node::LAMBDA:
|
case Node::LAMBDA:
|
||||||
|
|
Loading…
Reference in New Issue