summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript.cpp
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2018-05-29 23:16:56 -0300
committerGeorge Marques <george@gmarqu.es>2018-07-20 21:55:17 -0300
commit4b18c4e448c93fbb44c80b89e744cfacea8d8bc4 (patch)
tree82ee55b5fd0cc3fbe112344b029a5d5563094592 /modules/gdscript/gdscript.cpp
parent743053734f187c220250d88e4e475b7a87767cbc (diff)
downloadredot-engine-4b18c4e448c93fbb44c80b89e744cfacea8d8bc4.tar.gz
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.
Diffstat (limited to 'modules/gdscript/gdscript.cpp')
-rw-r--r--modules/gdscript/gdscript.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index ae8dcfc370..a8916c2a2e 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -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;
}
}