summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-01-11 14:46:38 +0100
committerGitHub <noreply@github.com>2017-01-11 14:46:38 +0100
commit42802ab9dc4c688f0300c51859cae1fe3c18017d (patch)
treeb2022cf7ad646ae9130b8f6d0146de81968d7b1b /modules
parent34c33648f236b50eb9a68b7a11ee811f979caa3f (diff)
parent713f1451b95c7dd29079496186fb157ac0a11b40 (diff)
Merge pull request #6930 from bojidar-bg/gdscript-export-array-hint
Allow typing hints for Array class (in GDScript and Inspector)
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gd_parser.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 1c4616555e..aab6946364 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -2658,10 +2658,34 @@ void GDParser::_parse_class(ClassNode *p_class) {
current_export.type=type;
current_export.usage|=PROPERTY_USAGE_SCRIPT_VARIABLE;
tokenizer->advance();
+
+ String hint_prefix ="";
+
+ if(type == Variant::ARRAY && tokenizer->get_token()==GDTokenizer::TK_COMMA) {
+ tokenizer->advance();
+
+ while(tokenizer->get_token()==GDTokenizer::TK_BUILT_IN_TYPE) {
+ type = tokenizer->get_token_type();
+
+ tokenizer->advance();
+
+ if(type == Variant::ARRAY) {
+ hint_prefix += itos(Variant::ARRAY)+":";
+ if (tokenizer->get_token()==GDTokenizer::TK_COMMA) {
+ tokenizer->advance();
+ }
+ } else {
+ hint_prefix += itos(type);
+ break;
+ }
+ }
+ }
+
if (tokenizer->get_token()==GDTokenizer::TK_COMMA) {
// hint expected next!
tokenizer->advance();
- switch(current_export.type) {
+
+ switch(type) {
case Variant::INT: {
@@ -3017,7 +3041,14 @@ void GDParser::_parse_class(ClassNode *p_class) {
return;
} break;
}
-
+
+ }
+ if(current_export.type == Variant::ARRAY && !hint_prefix.empty()) {
+ if(current_export.hint) {
+ hint_prefix += "/"+itos(current_export.hint);
+ }
+ current_export.hint_string=hint_prefix+":"+current_export.hint_string;
+ current_export.hint=PROPERTY_HINT_NONE;
}
} else if (tokenizer->get_token()==GDTokenizer::TK_IDENTIFIER) {