summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_parser.h
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2018-05-29 23:16:57 -0300
committerGeorge Marques <george@gmarqu.es>2018-07-20 21:55:17 -0300
commite3d72d14ff27af2b396397065ddc38f87685c694 (patch)
tree94fcdf65d7cc981042811c6c3050d81684604473 /modules/gdscript/gdscript_parser.h
parent4b18c4e448c93fbb44c80b89e744cfacea8d8bc4 (diff)
downloadredot-engine-e3d72d14ff27af2b396397065ddc38f87685c694.tar.gz
Use type information to enable GDScript introspection
This makes the Script API provide accurate information when requesting property or method info.
Diffstat (limited to 'modules/gdscript/gdscript_parser.h')
-rw-r--r--modules/gdscript/gdscript_parser.h43
1 files changed, 1 insertions, 42 deletions
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h
index 258dab2677..e9be25efc7 100644
--- a/modules/gdscript/gdscript_parser.h
+++ b/modules/gdscript/gdscript_parser.h
@@ -62,48 +62,7 @@ public:
Ref<Script> script_type;
ClassNode *class_type;
- String to_string() const {
- if (!has_type) return "var";
- switch (kind) {
- case BUILTIN: {
- if (builtin_type == Variant::NIL) return "null";
- return Variant::get_type_name(builtin_type);
- } break;
- case NATIVE: {
- if (is_meta_type) {
- return "GDScriptNativeClass";
- }
- return native_type.operator String();
- } break;
- case SCRIPT:
- case GDSCRIPT: {
- if (is_meta_type) {
- return script_type->get_class_name().operator String();
- }
- String name = script_type->get_name();
- if (name != String()) {
- return name;
- }
- name = script_type->get_path().get_file();
- if (name != String()) {
- return name;
- }
- return native_type.operator String();
- } break;
- case CLASS: {
- ERR_FAIL_COND_V(!class_type, String());
- if (is_meta_type) {
- return "GDScript";
- }
- if (class_type->name == StringName()) {
- return "self";
- }
- return class_type->name.operator String();
- } break;
- }
-
- return "Unresolved";
- }
+ String to_string() const;
bool operator==(const DataType &other) const {
if (!has_type || !other.has_type) {