mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
GDScript: Allow using self in lambdas
This commit is contained in:
parent
690fefe43e
commit
01d13ab2c1
16 changed files with 251 additions and 23 deletions
|
@ -1211,8 +1211,8 @@ void GDScriptByteCodeGenerator::write_call_script_function(const Address &p_targ
|
|||
append(p_function_name);
|
||||
}
|
||||
|
||||
void GDScriptByteCodeGenerator::write_lambda(const Address &p_target, GDScriptFunction *p_function, const Vector<Address> &p_captures) {
|
||||
append(GDScriptFunction::OPCODE_CREATE_LAMBDA, 1 + p_captures.size());
|
||||
void GDScriptByteCodeGenerator::write_lambda(const Address &p_target, GDScriptFunction *p_function, const Vector<Address> &p_captures, bool p_use_self) {
|
||||
append(p_use_self ? GDScriptFunction::OPCODE_CREATE_SELF_LAMBDA : GDScriptFunction::OPCODE_CREATE_LAMBDA, 1 + p_captures.size());
|
||||
for (int i = 0; i < p_captures.size(); i++) {
|
||||
append(p_captures[i]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue