Move Variant::evaluate() switch to computed goto
In an effort to make GDScript a little faster replace the double switch() with a computed goto on compilers that set __GNUC__. For compilers that don't support computed goto it will fall back to regular switch/case statements. In addition disable using boolean values in a mathematical context. Now boolean values can only be compared with other booleans. Booleans will also no longer be coerced to integers. This PR replaces #11308 and fixes #11291
This commit is contained in:
@ -1699,7 +1699,7 @@ GDParser::Node *GDParser::_reduce_expression(Node *p_node, bool p_to_const) {
|
||||
_REDUCE_BINARY(Variant::OP_ADD);
|
||||
} break;
|
||||
case OperatorNode::OP_SUB: {
|
||||
_REDUCE_BINARY(Variant::OP_SUBSTRACT);
|
||||
_REDUCE_BINARY(Variant::OP_SUBTRACT);
|
||||
} break;
|
||||
case OperatorNode::OP_MUL: {
|
||||
_REDUCE_BINARY(Variant::OP_MULTIPLY);
|
||||
|
||||
Reference in New Issue
Block a user