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:
George Marques 2018-05-29 23:16:56 -03:00
parent 743053734f
commit 4b18c4e448
No known key found for this signature in database
GPG key ID: 046BD46A3201E43D
4 changed files with 469 additions and 10 deletions

View file

@ -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;
}
}