mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Add typed instructions to GDScript
- Typed assignment (built-in, native, and script). - Cast (built-in conversion; native and script checks). - Check type of functions arguments on call. - Check type of members on set.
This commit is contained in:
parent
743053734f
commit
4b18c4e448
4 changed files with 469 additions and 10 deletions
|
@ -941,8 +941,12 @@ bool GDScriptInstance::set(const StringName &p_name, const Variant &p_value) {
|
|||
if (err.error == Variant::CallError::CALL_OK) {
|
||||
return true; //function exists, call was successful
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
if (!E->get().data_type.is_type(p_value)) {
|
||||
return false; // Type mismatch
|
||||
}
|
||||
members[E->get().index] = p_value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue