| 
									
										
										
										
											2023-01-05 13:25:55 +01:00
										 |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*  gdscript_byte_codegen.h                                               */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /*                         This file is part of:                          */ | 
					
						
							|  |  |  | /*                             GODOT ENGINE                               */ | 
					
						
							|  |  |  | /*                        https://godotengine.org                         */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							|  |  |  | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ | 
					
						
							|  |  |  | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* Permission is hereby granted, free of charge, to any person obtaining  */ | 
					
						
							|  |  |  | /* a copy of this software and associated documentation files (the        */ | 
					
						
							|  |  |  | /* "Software"), to deal in the Software without restriction, including    */ | 
					
						
							|  |  |  | /* without limitation the rights to use, copy, modify, merge, publish,    */ | 
					
						
							|  |  |  | /* distribute, sublicense, and/or sell copies of the Software, and to     */ | 
					
						
							|  |  |  | /* permit persons to whom the Software is furnished to do so, subject to  */ | 
					
						
							|  |  |  | /* the following conditions:                                              */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* The above copyright notice and this permission notice shall be         */ | 
					
						
							|  |  |  | /* included in all copies or substantial portions of the Software.        */ | 
					
						
							|  |  |  | /*                                                                        */ | 
					
						
							|  |  |  | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */ | 
					
						
							|  |  |  | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */ | 
					
						
							|  |  |  | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ | 
					
						
							|  |  |  | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */ | 
					
						
							|  |  |  | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */ | 
					
						
							|  |  |  | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */ | 
					
						
							|  |  |  | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */ | 
					
						
							|  |  |  | /**************************************************************************/ | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-23 23:41:51 +02:00
										 |  |  | #ifndef GDSCRIPT_BYTE_CODEGEN_H
 | 
					
						
							|  |  |  | #define GDSCRIPT_BYTE_CODEGEN_H
 | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "gdscript_codegen.h"
 | 
					
						
							| 
									
										
										
										
											2020-11-13 10:31:14 -03:00
										 |  |  | #include "gdscript_function.h"
 | 
					
						
							| 
									
										
										
										
											2020-11-26 11:56:32 -03:00
										 |  |  | #include "gdscript_utility_functions.h"
 | 
					
						
							| 
									
										
										
										
											2020-11-13 10:31:14 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | class GDScriptByteCodeGenerator : public GDScriptCodeGenerator { | 
					
						
							| 
									
										
										
										
											2021-04-14 14:35:51 -03:00
										 |  |  | 	struct StackSlot { | 
					
						
							|  |  |  | 		Variant::Type type = Variant::NIL; | 
					
						
							|  |  |  | 		Vector<int> bytecode_indices; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		StackSlot() = default; | 
					
						
							|  |  |  | 		StackSlot(Variant::Type p_type) : | 
					
						
							|  |  |  | 				type(p_type) {} | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	const static int RESERVED_STACK = 3; // For self, class, and nil.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-17 17:50:42 +01:00
										 |  |  | 	struct CallTarget { | 
					
						
							|  |  |  | 		Address target; | 
					
						
							|  |  |  | 		bool is_new_temporary = false; | 
					
						
							|  |  |  | 		GDScriptByteCodeGenerator *codegen = nullptr; | 
					
						
							|  |  |  | #ifdef DEV_ENABLED
 | 
					
						
							|  |  |  | 		bool cleaned = false; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		void cleanup() { | 
					
						
							|  |  |  | 			DEV_ASSERT(!cleaned); | 
					
						
							|  |  |  | 			if (is_new_temporary) { | 
					
						
							|  |  |  | 				codegen->pop_temporary(); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | #ifdef DEV_ENABLED
 | 
					
						
							|  |  |  | 			cleaned = true; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		CallTarget(Address p_target, bool p_is_new_temporary, GDScriptByteCodeGenerator *p_codegen) : | 
					
						
							|  |  |  | 				target(p_target), | 
					
						
							|  |  |  | 				is_new_temporary(p_is_new_temporary), | 
					
						
							|  |  |  | 				codegen(p_codegen) {} | 
					
						
							|  |  |  | 		~CallTarget() { DEV_ASSERT(cleaned); } | 
					
						
							|  |  |  | 		CallTarget(const CallTarget &) = delete; | 
					
						
							|  |  |  | 		CallTarget &operator=(CallTarget &) = delete; | 
					
						
							|  |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	bool ended = false; | 
					
						
							|  |  |  | 	GDScriptFunction *function = nullptr; | 
					
						
							|  |  |  | 	bool debug_stack = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	Vector<int> opcodes; | 
					
						
							| 
									
										
										
										
											2022-05-13 15:04:37 +02:00
										 |  |  | 	List<RBMap<StringName, int>> stack_id_stack; | 
					
						
							|  |  |  | 	RBMap<StringName, int> stack_identifiers; | 
					
						
							| 
									
										
										
										
											2020-11-22 12:24:40 -03:00
										 |  |  | 	List<int> stack_identifiers_counts; | 
					
						
							| 
									
										
										
										
											2022-05-13 15:04:37 +02:00
										 |  |  | 	RBMap<StringName, int> local_constants; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-14 14:35:51 -03:00
										 |  |  | 	Vector<StackSlot> locals; | 
					
						
							|  |  |  | 	Vector<StackSlot> temporaries; | 
					
						
							|  |  |  | 	List<int> used_temporaries; | 
					
						
							| 
									
										
										
										
											2023-04-11 17:20:03 +02:00
										 |  |  | 	List<int> temporaries_pending_clear; | 
					
						
							| 
									
										
										
										
											2022-05-13 15:04:37 +02:00
										 |  |  | 	RBMap<Variant::Type, List<int>> temporaries_pool; | 
					
						
							| 
									
										
										
										
											2021-04-14 14:35:51 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	List<GDScriptFunction::StackDebug> stack_debug; | 
					
						
							| 
									
										
										
										
											2022-05-13 15:04:37 +02:00
										 |  |  | 	List<RBMap<StringName, int>> block_identifier_stack; | 
					
						
							|  |  |  | 	RBMap<StringName, int> block_identifiers; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-14 14:35:51 -03:00
										 |  |  | 	int max_locals = 0; | 
					
						
							| 
									
										
										
										
											2020-11-13 16:47:45 -03:00
										 |  |  | 	int current_line = 0; | 
					
						
							|  |  |  | 	int instr_args_max = 0; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-22 12:24:40 -03:00
										 |  |  | #ifdef DEBUG_ENABLED
 | 
					
						
							|  |  |  | 	List<int> temp_stack; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	HashMap<Variant, int, VariantHasher, VariantComparator> constant_map; | 
					
						
							| 
									
										
										
										
											2022-05-13 15:04:37 +02:00
										 |  |  | 	RBMap<StringName, int> name_map; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | #ifdef TOOLS_ENABLED
 | 
					
						
							|  |  |  | 	Vector<StringName> named_globals; | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2022-05-13 15:04:37 +02:00
										 |  |  | 	RBMap<Variant::ValidatedOperatorEvaluator, int> operator_func_map; | 
					
						
							|  |  |  | 	RBMap<Variant::ValidatedSetter, int> setters_map; | 
					
						
							|  |  |  | 	RBMap<Variant::ValidatedGetter, int> getters_map; | 
					
						
							|  |  |  | 	RBMap<Variant::ValidatedKeyedSetter, int> keyed_setters_map; | 
					
						
							|  |  |  | 	RBMap<Variant::ValidatedKeyedGetter, int> keyed_getters_map; | 
					
						
							|  |  |  | 	RBMap<Variant::ValidatedIndexedSetter, int> indexed_setters_map; | 
					
						
							|  |  |  | 	RBMap<Variant::ValidatedIndexedGetter, int> indexed_getters_map; | 
					
						
							|  |  |  | 	RBMap<Variant::ValidatedBuiltInMethod, int> builtin_method_map; | 
					
						
							|  |  |  | 	RBMap<Variant::ValidatedConstructor, int> constructors_map; | 
					
						
							|  |  |  | 	RBMap<Variant::ValidatedUtilityFunction, int> utilities_map; | 
					
						
							|  |  |  | 	RBMap<GDScriptUtilityFunctions::FunctionPtr, int> gds_utilities_map; | 
					
						
							|  |  |  | 	RBMap<MethodBind *, int> method_bind_map; | 
					
						
							|  |  |  | 	RBMap<GDScriptFunction *, int> lambdas_map; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-29 10:47:53 -03:00
										 |  |  | #if DEBUG_ENABLED
 | 
					
						
							|  |  |  | 	// Keep method and property names for pointer and validated operations.
 | 
					
						
							|  |  |  | 	// Used when disassembling the bytecode.
 | 
					
						
							|  |  |  | 	Vector<String> operator_names; | 
					
						
							|  |  |  | 	Vector<String> setter_names; | 
					
						
							|  |  |  | 	Vector<String> getter_names; | 
					
						
							|  |  |  | 	Vector<String> builtin_methods_names; | 
					
						
							|  |  |  | 	Vector<String> constructors_names; | 
					
						
							|  |  |  | 	Vector<String> utilities_names; | 
					
						
							|  |  |  | 	Vector<String> gds_utilities_names; | 
					
						
							|  |  |  | 	void add_debug_name(Vector<String> &vector, int index, const String &name) { | 
					
						
							|  |  |  | 		if (index >= vector.size()) { | 
					
						
							|  |  |  | 			vector.resize(index + 1); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		vector.write[index] = name; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-22 12:24:40 -03:00
										 |  |  | 	// Lists since these can be nested.
 | 
					
						
							|  |  |  | 	List<int> if_jmp_addrs; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	List<int> for_jmp_addrs; | 
					
						
							| 
									
										
										
										
											2020-11-22 12:24:40 -03:00
										 |  |  | 	List<Address> for_counter_variables; | 
					
						
							|  |  |  | 	List<Address> for_container_variables; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	List<int> while_jmp_addrs; | 
					
						
							|  |  |  | 	List<int> continue_addrs; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// Used to patch jumps with `and` and `or` operators with short-circuit.
 | 
					
						
							|  |  |  | 	List<int> logic_op_jump_pos1; | 
					
						
							|  |  |  | 	List<int> logic_op_jump_pos2; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	List<Address> ternary_result; | 
					
						
							|  |  |  | 	List<int> ternary_jump_fail_pos; | 
					
						
							|  |  |  | 	List<int> ternary_jump_skip_pos; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	List<List<int>> current_breaks_to_patch; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void add_stack_identifier(const StringName &p_id, int p_stackpos) { | 
					
						
							| 
									
										
										
										
											2021-04-14 14:35:51 -03:00
										 |  |  | 		if (locals.size() > max_locals) { | 
					
						
							|  |  |  | 			max_locals = locals.size(); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 		stack_identifiers[p_id] = p_stackpos; | 
					
						
							|  |  |  | 		if (debug_stack) { | 
					
						
							|  |  |  | 			block_identifiers[p_id] = p_stackpos; | 
					
						
							|  |  |  | 			GDScriptFunction::StackDebug sd; | 
					
						
							|  |  |  | 			sd.added = true; | 
					
						
							|  |  |  | 			sd.line = current_line; | 
					
						
							|  |  |  | 			sd.identifier = p_id; | 
					
						
							|  |  |  | 			sd.pos = p_stackpos; | 
					
						
							|  |  |  | 			stack_debug.push_back(sd); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void push_stack_identifiers() { | 
					
						
							| 
									
										
										
										
											2021-04-14 14:35:51 -03:00
										 |  |  | 		stack_identifiers_counts.push_back(locals.size()); | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 		stack_id_stack.push_back(stack_identifiers); | 
					
						
							|  |  |  | 		if (debug_stack) { | 
					
						
							| 
									
										
										
										
											2022-05-13 15:04:37 +02:00
										 |  |  | 			RBMap<StringName, int> block_ids(block_identifiers); | 
					
						
							| 
									
										
										
										
											2020-11-22 12:24:40 -03:00
										 |  |  | 			block_identifier_stack.push_back(block_ids); | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 			block_identifiers.clear(); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void pop_stack_identifiers() { | 
					
						
							| 
									
										
										
										
											2021-04-14 14:35:51 -03:00
										 |  |  | 		int current_locals = stack_identifiers_counts.back()->get(); | 
					
						
							| 
									
										
										
										
											2020-11-22 12:24:40 -03:00
										 |  |  | 		stack_identifiers_counts.pop_back(); | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 		stack_identifiers = stack_id_stack.back()->get(); | 
					
						
							|  |  |  | 		stack_id_stack.pop_back(); | 
					
						
							| 
									
										
										
										
											2020-11-22 12:24:40 -03:00
										 |  |  | #ifdef DEBUG_ENABLED
 | 
					
						
							| 
									
										
										
										
											2021-04-14 14:35:51 -03:00
										 |  |  | 		if (!used_temporaries.is_empty()) { | 
					
						
							|  |  |  | 			ERR_PRINT("Leaving block with non-zero temporary variables: " + itos(used_temporaries.size())); | 
					
						
							| 
									
										
										
										
											2020-11-22 12:24:40 -03:00
										 |  |  | 		} | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2021-04-14 14:35:51 -03:00
										 |  |  | 		locals.resize(current_locals); | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 		if (debug_stack) { | 
					
						
							| 
									
										
										
										
											2021-08-09 14:13:42 -06:00
										 |  |  | 			for (const KeyValue<StringName, int> &E : block_identifiers) { | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 				GDScriptFunction::StackDebug sd; | 
					
						
							|  |  |  | 				sd.added = false; | 
					
						
							| 
									
										
										
										
											2021-08-09 14:13:42 -06:00
										 |  |  | 				sd.identifier = E.key; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 				sd.line = current_line; | 
					
						
							| 
									
										
										
										
											2021-08-09 14:13:42 -06:00
										 |  |  | 				sd.pos = E.value; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 				stack_debug.push_back(sd); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			block_identifiers = block_identifier_stack.back()->get(); | 
					
						
							|  |  |  | 			block_identifier_stack.pop_back(); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int get_name_map_pos(const StringName &p_identifier) { | 
					
						
							|  |  |  | 		int ret; | 
					
						
							|  |  |  | 		if (!name_map.has(p_identifier)) { | 
					
						
							|  |  |  | 			ret = name_map.size(); | 
					
						
							|  |  |  | 			name_map[p_identifier] = ret; | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			ret = name_map[p_identifier]; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return ret; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int get_constant_pos(const Variant &p_constant) { | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		if (constant_map.has(p_constant)) { | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 			return constant_map[p_constant]; | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 		int pos = constant_map.size(); | 
					
						
							|  |  |  | 		constant_map[p_constant] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-13 16:47:45 -03:00
										 |  |  | 	int get_operation_pos(const Variant::ValidatedOperatorEvaluator p_operation) { | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		if (operator_func_map.has(p_operation)) { | 
					
						
							| 
									
										
										
										
											2020-11-13 16:47:45 -03:00
										 |  |  | 			return operator_func_map[p_operation]; | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-11-13 16:47:45 -03:00
										 |  |  | 		int pos = operator_func_map.size(); | 
					
						
							|  |  |  | 		operator_func_map[p_operation] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 	int get_setter_pos(const Variant::ValidatedSetter p_setter) { | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		if (setters_map.has(p_setter)) { | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 			return setters_map[p_setter]; | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 		int pos = setters_map.size(); | 
					
						
							|  |  |  | 		setters_map[p_setter] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int get_getter_pos(const Variant::ValidatedGetter p_getter) { | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		if (getters_map.has(p_getter)) { | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 			return getters_map[p_getter]; | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 		int pos = getters_map.size(); | 
					
						
							|  |  |  | 		getters_map[p_getter] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int get_keyed_setter_pos(const Variant::ValidatedKeyedSetter p_keyed_setter) { | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		if (keyed_setters_map.has(p_keyed_setter)) { | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 			return keyed_setters_map[p_keyed_setter]; | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 		int pos = keyed_setters_map.size(); | 
					
						
							|  |  |  | 		keyed_setters_map[p_keyed_setter] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int get_keyed_getter_pos(const Variant::ValidatedKeyedGetter p_keyed_getter) { | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		if (keyed_getters_map.has(p_keyed_getter)) { | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 			return keyed_getters_map[p_keyed_getter]; | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 		int pos = keyed_getters_map.size(); | 
					
						
							|  |  |  | 		keyed_getters_map[p_keyed_getter] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int get_indexed_setter_pos(const Variant::ValidatedIndexedSetter p_indexed_setter) { | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		if (indexed_setters_map.has(p_indexed_setter)) { | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 			return indexed_setters_map[p_indexed_setter]; | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 		int pos = indexed_setters_map.size(); | 
					
						
							|  |  |  | 		indexed_setters_map[p_indexed_setter] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int get_indexed_getter_pos(const Variant::ValidatedIndexedGetter p_indexed_getter) { | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		if (indexed_getters_map.has(p_indexed_getter)) { | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 			return indexed_getters_map[p_indexed_getter]; | 
					
						
							| 
									
										
										
										
											2021-04-05 14:09:59 +02:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 		int pos = indexed_getters_map.size(); | 
					
						
							|  |  |  | 		indexed_getters_map[p_indexed_getter] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-18 10:32:28 -03:00
										 |  |  | 	int get_builtin_method_pos(const Variant::ValidatedBuiltInMethod p_method) { | 
					
						
							|  |  |  | 		if (builtin_method_map.has(p_method)) { | 
					
						
							|  |  |  | 			return builtin_method_map[p_method]; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		int pos = builtin_method_map.size(); | 
					
						
							|  |  |  | 		builtin_method_map[p_method] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-18 11:37:08 -03:00
										 |  |  | 	int get_constructor_pos(const Variant::ValidatedConstructor p_constructor) { | 
					
						
							|  |  |  | 		if (constructors_map.has(p_constructor)) { | 
					
						
							|  |  |  | 			return constructors_map[p_constructor]; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		int pos = constructors_map.size(); | 
					
						
							|  |  |  | 		constructors_map[p_constructor] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-26 11:56:32 -03:00
										 |  |  | 	int get_utility_pos(const Variant::ValidatedUtilityFunction p_utility) { | 
					
						
							|  |  |  | 		if (utilities_map.has(p_utility)) { | 
					
						
							|  |  |  | 			return utilities_map[p_utility]; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		int pos = utilities_map.size(); | 
					
						
							|  |  |  | 		utilities_map[p_utility] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	int get_gds_utility_pos(const GDScriptUtilityFunctions::FunctionPtr p_gds_utility) { | 
					
						
							|  |  |  | 		if (gds_utilities_map.has(p_gds_utility)) { | 
					
						
							|  |  |  | 			return gds_utilities_map[p_gds_utility]; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		int pos = gds_utilities_map.size(); | 
					
						
							|  |  |  | 		gds_utilities_map[p_gds_utility] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-17 10:44:52 -03:00
										 |  |  | 	int get_method_bind_pos(MethodBind *p_method) { | 
					
						
							|  |  |  | 		if (method_bind_map.has(p_method)) { | 
					
						
							|  |  |  | 			return method_bind_map[p_method]; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		int pos = method_bind_map.size(); | 
					
						
							|  |  |  | 		method_bind_map[p_method] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-28 11:03:13 -03:00
										 |  |  | 	int get_lambda_function_pos(GDScriptFunction *p_lambda_function) { | 
					
						
							|  |  |  | 		if (lambdas_map.has(p_lambda_function)) { | 
					
						
							|  |  |  | 			return lambdas_map[p_lambda_function]; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		int pos = lambdas_map.size(); | 
					
						
							|  |  |  | 		lambdas_map[p_lambda_function] = pos; | 
					
						
							|  |  |  | 		return pos; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-17 17:50:42 +01:00
										 |  |  | 	CallTarget get_call_target(const Address &p_target, Variant::Type p_type = Variant::NIL); | 
					
						
							| 
									
										
										
										
											2023-01-09 09:20:18 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	int address_of(const Address &p_address) { | 
					
						
							|  |  |  | 		switch (p_address.mode) { | 
					
						
							|  |  |  | 			case Address::SELF: | 
					
						
							| 
									
										
										
										
											2021-04-08 11:55:24 -03:00
										 |  |  | 				return GDScriptFunction::ADDR_SELF; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 			case Address::CLASS: | 
					
						
							| 
									
										
										
										
											2021-04-08 11:55:24 -03:00
										 |  |  | 				return GDScriptFunction::ADDR_CLASS; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 			case Address::MEMBER: | 
					
						
							|  |  |  | 				return p_address.address | (GDScriptFunction::ADDR_TYPE_MEMBER << GDScriptFunction::ADDR_BITS); | 
					
						
							|  |  |  | 			case Address::CONSTANT: | 
					
						
							| 
									
										
										
										
											2021-04-08 11:55:24 -03:00
										 |  |  | 				return p_address.address | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS); | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 			case Address::LOCAL_VARIABLE: | 
					
						
							|  |  |  | 			case Address::FUNCTION_PARAMETER: | 
					
						
							|  |  |  | 				return p_address.address | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); | 
					
						
							| 
									
										
										
										
											2021-04-14 14:35:51 -03:00
										 |  |  | 			case Address::TEMPORARY: | 
					
						
							|  |  |  | 				temporaries.write[p_address.address].bytecode_indices.push_back(opcodes.size()); | 
					
						
							|  |  |  | 				return -1; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 			case Address::NIL: | 
					
						
							| 
									
										
										
										
											2021-04-08 11:55:24 -03:00
										 |  |  | 				return GDScriptFunction::ADDR_NIL; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		return -1; // Unreachable.
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-01-02 15:29:44 +01:00
										 |  |  | 	void append_opcode(GDScriptFunction::Opcode p_code) { | 
					
						
							|  |  |  | 		opcodes.push_back(p_code); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void append_opcode_and_argcount(GDScriptFunction::Opcode p_code, int p_argument_count) { | 
					
						
							|  |  |  | 		opcodes.push_back(p_code); | 
					
						
							|  |  |  | 		opcodes.push_back(p_argument_count); | 
					
						
							| 
									
										
										
										
											2020-11-13 10:31:14 -03:00
										 |  |  | 		instr_args_max = MAX(instr_args_max, p_argument_count); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void append(int p_code) { | 
					
						
							|  |  |  | 		opcodes.push_back(p_code); | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void append(const Address &p_address) { | 
					
						
							|  |  |  | 		opcodes.push_back(address_of(p_address)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void append(const StringName &p_name) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_name_map_pos(p_name)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-13 16:47:45 -03:00
										 |  |  | 	void append(const Variant::ValidatedOperatorEvaluator p_operation) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_operation_pos(p_operation)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-16 12:59:53 -03:00
										 |  |  | 	void append(const Variant::ValidatedSetter p_setter) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_setter_pos(p_setter)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void append(const Variant::ValidatedGetter p_getter) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_getter_pos(p_getter)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void append(const Variant::ValidatedKeyedSetter p_keyed_setter) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_keyed_setter_pos(p_keyed_setter)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void append(const Variant::ValidatedKeyedGetter p_keyed_getter) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_keyed_getter_pos(p_keyed_getter)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void append(const Variant::ValidatedIndexedSetter p_indexed_setter) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_indexed_setter_pos(p_indexed_setter)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void append(const Variant::ValidatedIndexedGetter p_indexed_getter) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_indexed_getter_pos(p_indexed_getter)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-18 10:32:28 -03:00
										 |  |  | 	void append(const Variant::ValidatedBuiltInMethod p_method) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_builtin_method_pos(p_method)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-18 11:37:08 -03:00
										 |  |  | 	void append(const Variant::ValidatedConstructor p_constructor) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_constructor_pos(p_constructor)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-26 11:56:32 -03:00
										 |  |  | 	void append(const Variant::ValidatedUtilityFunction p_utility) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_utility_pos(p_utility)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	void append(const GDScriptUtilityFunctions::FunctionPtr p_gds_utility) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_gds_utility_pos(p_gds_utility)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-17 10:44:52 -03:00
										 |  |  | 	void append(MethodBind *p_method) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_method_bind_pos(p_method)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-28 11:03:13 -03:00
										 |  |  | 	void append(GDScriptFunction *p_lambda_function) { | 
					
						
							|  |  |  | 		opcodes.push_back(get_lambda_function_pos(p_lambda_function)); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	void patch_jump(int p_address) { | 
					
						
							|  |  |  | 		opcodes.write[p_address] = opcodes.size(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  | 	virtual uint32_t add_parameter(const StringName &p_name, bool p_is_optional, const GDScriptDataType &p_type) override; | 
					
						
							|  |  |  | 	virtual uint32_t add_local(const StringName &p_name, const GDScriptDataType &p_type) override; | 
					
						
							|  |  |  | 	virtual uint32_t add_local_constant(const StringName &p_name, const Variant &p_constant) override; | 
					
						
							|  |  |  | 	virtual uint32_t add_or_get_constant(const Variant &p_constant) override; | 
					
						
							|  |  |  | 	virtual uint32_t add_or_get_name(const StringName &p_name) override; | 
					
						
							| 
									
										
										
										
											2021-04-14 14:35:51 -03:00
										 |  |  | 	virtual uint32_t add_temporary(const GDScriptDataType &p_type) override; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	virtual void pop_temporary() override; | 
					
						
							| 
									
										
										
										
											2023-04-11 17:20:03 +02:00
										 |  |  | 	virtual void clean_temporaries() override; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	virtual void start_parameters() override; | 
					
						
							|  |  |  | 	virtual void end_parameters() override; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual void start_block() override; | 
					
						
							|  |  |  | 	virtual void end_block() override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-12 23:12:42 +02:00
										 |  |  | 	virtual void write_start(GDScript *p_script, const StringName &p_function_name, bool p_static, Variant p_rpc_config, const GDScriptDataType &p_return_type) override; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	virtual GDScriptFunction *write_end() override; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef DEBUG_ENABLED
 | 
					
						
							|  |  |  | 	virtual void set_signature(const String &p_signature) override; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	virtual void set_initial_line(int p_line) override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-16 12:04:08 -03:00
										 |  |  | 	virtual void write_type_adjust(const Address &p_target, Variant::Type p_new_type) override; | 
					
						
							| 
									
										
										
										
											2020-11-26 14:41:55 -03:00
										 |  |  | 	virtual void write_unary_operator(const Address &p_target, Variant::Operator p_operator, const Address &p_left_operand) override; | 
					
						
							|  |  |  | 	virtual void write_binary_operator(const Address &p_target, Variant::Operator p_operator, const Address &p_left_operand, const Address &p_right_operand) override; | 
					
						
							| 
									
										
										
										
											2023-02-17 01:16:24 +02:00
										 |  |  | 	virtual void write_type_test(const Address &p_target, const Address &p_source, const GDScriptDataType &p_type) override; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	virtual void write_and_left_operand(const Address &p_left_operand) override; | 
					
						
							|  |  |  | 	virtual void write_and_right_operand(const Address &p_right_operand) override; | 
					
						
							|  |  |  | 	virtual void write_end_and(const Address &p_target) override; | 
					
						
							|  |  |  | 	virtual void write_or_left_operand(const Address &p_left_operand) override; | 
					
						
							|  |  |  | 	virtual void write_or_right_operand(const Address &p_right_operand) override; | 
					
						
							|  |  |  | 	virtual void write_end_or(const Address &p_target) override; | 
					
						
							|  |  |  | 	virtual void write_start_ternary(const Address &p_target) override; | 
					
						
							|  |  |  | 	virtual void write_ternary_condition(const Address &p_condition) override; | 
					
						
							|  |  |  | 	virtual void write_ternary_true_expr(const Address &p_expr) override; | 
					
						
							|  |  |  | 	virtual void write_ternary_false_expr(const Address &p_expr) override; | 
					
						
							|  |  |  | 	virtual void write_end_ternary() override; | 
					
						
							|  |  |  | 	virtual void write_set(const Address &p_target, const Address &p_index, const Address &p_source) override; | 
					
						
							|  |  |  | 	virtual void write_get(const Address &p_target, const Address &p_index, const Address &p_source) override; | 
					
						
							|  |  |  | 	virtual void write_set_named(const Address &p_target, const StringName &p_name, const Address &p_source) override; | 
					
						
							|  |  |  | 	virtual void write_get_named(const Address &p_target, const StringName &p_name, const Address &p_source) override; | 
					
						
							|  |  |  | 	virtual void write_set_member(const Address &p_value, const StringName &p_name) override; | 
					
						
							|  |  |  | 	virtual void write_get_member(const Address &p_target, const StringName &p_name) override; | 
					
						
							| 
									
										
										
										
											2023-05-16 13:03:53 +03:00
										 |  |  | 	virtual void write_set_static_variable(const Address &p_value, const Address &p_class, int p_index) override; | 
					
						
							|  |  |  | 	virtual void write_get_static_variable(const Address &p_target, const Address &p_class, int p_index) override; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	virtual void write_assign(const Address &p_target, const Address &p_source) override; | 
					
						
							| 
									
										
										
										
											2021-05-26 14:05:31 -03:00
										 |  |  | 	virtual void write_assign_with_conversion(const Address &p_target, const Address &p_source) override; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	virtual void write_assign_true(const Address &p_target) override; | 
					
						
							|  |  |  | 	virtual void write_assign_false(const Address &p_target) override; | 
					
						
							| 
									
										
										
										
											2023-01-06 11:49:06 +02:00
										 |  |  | 	virtual void write_assign_default_parameter(const Address &p_dst, const Address &p_src, bool p_use_conversion) override; | 
					
						
							| 
									
										
										
										
											2021-09-01 16:01:39 -03:00
										 |  |  | 	virtual void write_store_global(const Address &p_dst, int p_global_index) override; | 
					
						
							| 
									
										
										
										
											2021-04-08 11:55:24 -03:00
										 |  |  | 	virtual void write_store_named_global(const Address &p_dst, const StringName &p_global) override; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	virtual void write_cast(const Address &p_target, const Address &p_source, const GDScriptDataType &p_type) override; | 
					
						
							|  |  |  | 	virtual void write_call(const Address &p_target, const Address &p_base, const StringName &p_function_name, const Vector<Address> &p_arguments) override; | 
					
						
							|  |  |  | 	virtual void write_super_call(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) override; | 
					
						
							|  |  |  | 	virtual void write_call_async(const Address &p_target, const Address &p_base, const StringName &p_function_name, const Vector<Address> &p_arguments) override; | 
					
						
							| 
									
										
										
										
											2020-11-26 11:56:32 -03:00
										 |  |  | 	virtual void write_call_utility(const Address &p_target, const StringName &p_function, const Vector<Address> &p_arguments) override; | 
					
						
							| 
									
										
										
										
											2023-01-11 14:24:23 -03:00
										 |  |  | 	void write_call_builtin_type(const Address &p_target, const Address &p_base, Variant::Type p_type, const StringName &p_method, bool p_is_static, const Vector<Address> &p_arguments); | 
					
						
							| 
									
										
										
										
											2022-12-29 10:47:53 -03:00
										 |  |  | 	virtual void write_call_gdscript_utility(const Address &p_target, const StringName &p_function, const Vector<Address> &p_arguments) override; | 
					
						
							| 
									
										
										
										
											2020-11-18 10:32:28 -03:00
										 |  |  | 	virtual void write_call_builtin_type(const Address &p_target, const Address &p_base, Variant::Type p_type, const StringName &p_method, const Vector<Address> &p_arguments) override; | 
					
						
							| 
									
										
										
										
											2021-05-16 11:48:53 -03:00
										 |  |  | 	virtual void write_call_builtin_type_static(const Address &p_target, Variant::Type p_type, const StringName &p_method, const Vector<Address> &p_arguments) override; | 
					
						
							| 
									
										
										
										
											2022-04-06 14:14:38 -03:00
										 |  |  | 	virtual void write_call_native_static(const Address &p_target, const StringName &p_class, const StringName &p_method, const Vector<Address> &p_arguments) override; | 
					
						
							| 
									
										
										
										
											2020-11-17 10:44:52 -03:00
										 |  |  | 	virtual void write_call_method_bind(const Address &p_target, const Address &p_base, MethodBind *p_method, const Vector<Address> &p_arguments) override; | 
					
						
							| 
									
										
										
										
											2023-07-25 12:42:07 -03:00
										 |  |  | 	virtual void write_call_method_bind_validated(const Address &p_target, const Address &p_base, MethodBind *p_method, const Vector<Address> &p_arguments) override; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	virtual void write_call_self(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) override; | 
					
						
							| 
									
										
										
										
											2020-12-04 16:42:45 -07:00
										 |  |  | 	virtual void write_call_self_async(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) override; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	virtual void write_call_script_function(const Address &p_target, const Address &p_base, const StringName &p_function_name, const Vector<Address> &p_arguments) override; | 
					
						
							| 
									
										
										
										
											2022-04-20 14:22:22 -03:00
										 |  |  | 	virtual void write_lambda(const Address &p_target, GDScriptFunction *p_function, const Vector<Address> &p_captures, bool p_use_self) override; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	virtual void write_construct(const Address &p_target, Variant::Type p_type, const Vector<Address> &p_arguments) override; | 
					
						
							|  |  |  | 	virtual void write_construct_array(const Address &p_target, const Vector<Address> &p_arguments) override; | 
					
						
							| 
									
										
										
										
											2021-03-09 12:32:35 -03:00
										 |  |  | 	virtual void write_construct_typed_array(const Address &p_target, const GDScriptDataType &p_element_type, const Vector<Address> &p_arguments) override; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	virtual void write_construct_dictionary(const Address &p_target, const Vector<Address> &p_arguments) override; | 
					
						
							|  |  |  | 	virtual void write_await(const Address &p_target, const Address &p_operand) override; | 
					
						
							|  |  |  | 	virtual void write_if(const Address &p_condition) override; | 
					
						
							|  |  |  | 	virtual void write_else() override; | 
					
						
							|  |  |  | 	virtual void write_endif() override; | 
					
						
							| 
									
										
										
										
											2022-06-27 12:09:51 -03:00
										 |  |  | 	virtual void write_jump_if_shared(const Address &p_value) override; | 
					
						
							|  |  |  | 	virtual void write_end_jump_if_shared() override; | 
					
						
							| 
									
										
										
										
											2020-11-22 12:24:40 -03:00
										 |  |  | 	virtual void start_for(const GDScriptDataType &p_iterator_type, const GDScriptDataType &p_list_type) override; | 
					
						
							| 
									
										
										
										
											2023-08-04 12:19:11 +03:00
										 |  |  | 	virtual void write_for_assignment(const Address &p_list) override; | 
					
						
							|  |  |  | 	virtual void write_for(const Address &p_variable, bool p_use_conversion) override; | 
					
						
							| 
									
										
										
										
											2020-07-28 15:17:49 -03:00
										 |  |  | 	virtual void write_endfor() override; | 
					
						
							|  |  |  | 	virtual void start_while_condition() override; | 
					
						
							|  |  |  | 	virtual void write_while(const Address &p_condition) override; | 
					
						
							|  |  |  | 	virtual void write_endwhile() override; | 
					
						
							|  |  |  | 	virtual void write_break() override; | 
					
						
							|  |  |  | 	virtual void write_continue() override; | 
					
						
							|  |  |  | 	virtual void write_breakpoint() override; | 
					
						
							|  |  |  | 	virtual void write_newline(int p_line) override; | 
					
						
							|  |  |  | 	virtual void write_return(const Address &p_return_value) override; | 
					
						
							|  |  |  | 	virtual void write_assert(const Address &p_test, const Address &p_message) override; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	virtual ~GDScriptByteCodeGenerator(); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-23 23:41:51 +02:00
										 |  |  | #endif // GDSCRIPT_BYTE_CODEGEN_H
 |