MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / write_unary_operator

Method write_unary_operator

modules/gdscript/gdscript_byte_codegen.cpp:562–590  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

560}
561
562void GDScriptByteCodeGenerator::write_unary_operator(const Address &p_target, Variant::Operator p_operator, const Address &p_left_operand) {
563 if (HAS_BUILTIN_TYPE(p_left_operand)) {
564 // Gather specific operator.
565 Variant::ValidatedOperatorEvaluator op_func = Variant::get_validated_operator_evaluator(p_operator, p_left_operand.type.builtin_type, Variant::NIL);
566
567 append_opcode(GDScriptFunction::OPCODE_OPERATOR_VALIDATED);
568 append(p_left_operand);
569 append(Address());
570 append(p_target);
571 append(op_func);
572#ifdef DEBUG_ENABLED
573 add_debug_name(operator_names, get_operation_pos(op_func), Variant::get_operator_name(p_operator));
574#endif
575 return;
576 }
577
578 // No specific types, perform variant evaluation.
579 append_opcode(GDScriptFunction::OPCODE_OPERATOR);
580 append(p_left_operand);
581 append(Address());
582 append(p_target);
583 append(p_operator);
584 append(0); // Signature storage.
585 append(0); // Return type storage.
586 constexpr int _pointer_size = sizeof(Variant::ValidatedOperatorEvaluator) / sizeof(*(opcodes.ptr()));
587 for (int i = 0; i < _pointer_size; i++) {
588 append(0); // Space for function pointer.
589 }
590}
591
592void GDScriptByteCodeGenerator::write_binary_operator(const Address &p_target, Variant::Operator p_operator, const Address &p_left_operand, const Address &p_right_operand) {
593 bool valid = HAS_BUILTIN_TYPE(p_left_operand) && HAS_BUILTIN_TYPE(p_right_operand);

Callers 1

_parse_expressionMethod · 0.80

Calls 2

AddressEnum · 0.70
ptrMethod · 0.45

Tested by

no test coverage detected