You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Add static type checks in the parser
- Resolve types for all identifiers. - Error when identifier is not found. - Match return type and error when not returning a value when it should. - Check unreachable code (code after sure return). - Match argument count and types for function calls. - Determine if return type of function call matches the assignment. - Do static type check with match statement when possible. - Use type hints to determine export type. - Check compatibility between type hint and explicit export type.
This commit is contained in:
@@ -64,6 +64,7 @@ class GDScript : public Script {
|
||||
StringName setter;
|
||||
StringName getter;
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
GDScriptDataType data_type;
|
||||
};
|
||||
|
||||
friend class GDScriptInstance;
|
||||
@@ -145,6 +146,10 @@ public:
|
||||
const Map<StringName, Ref<GDScript> > &get_subclasses() const { return subclasses; }
|
||||
const Map<StringName, Variant> &get_constants() const { return constants; }
|
||||
const Set<StringName> &get_members() const { return members; }
|
||||
const GDScriptDataType &get_member_type(const StringName &p_member) const {
|
||||
ERR_FAIL_COND_V(!member_indices.has(p_member), GDScriptDataType());
|
||||
return member_indices[p_member].data_type;
|
||||
}
|
||||
const Map<StringName, GDScriptFunction *> &get_member_functions() const { return member_functions; }
|
||||
const Ref<GDScriptNativeClass> &get_native() const { return native; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user