summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/gdscript_parser.h')
-rw-r--r--modules/gdscript/gdscript_parser.h59
1 files changed, 39 insertions, 20 deletions
diff --git a/modules/gdscript/gdscript_parser.h b/modules/gdscript/gdscript_parser.h
index 18757eb9fd..71660d8f60 100644
--- a/modules/gdscript/gdscript_parser.h
+++ b/modules/gdscript/gdscript_parser.h
@@ -257,6 +257,22 @@ public:
int line = 0, column = 0;
};
+#ifdef TOOLS_ENABLED
+ struct ClassDocData {
+ String brief;
+ String description;
+ Vector<Pair<String, String>> tutorials;
+ bool is_deprecated = false;
+ bool is_experimental = false;
+ };
+
+ struct MemberDocData {
+ String description;
+ bool is_deprecated = false;
+ bool is_experimental = false;
+ };
+#endif // TOOLS_ENABLED
+
struct Node {
enum Type {
NONE,
@@ -505,7 +521,7 @@ public:
int leftmost_column = 0;
int rightmost_column = 0;
#ifdef TOOLS_ENABLED
- String doc_description;
+ MemberDocData doc_data;
#endif // TOOLS_ENABLED
};
@@ -513,7 +529,7 @@ public:
Vector<Value> values;
Variant dictionary;
#ifdef TOOLS_ENABLED
- String doc_description;
+ MemberDocData doc_data;
#endif // TOOLS_ENABLED
EnumNode() {
@@ -720,14 +736,12 @@ public:
DataType base_type;
String fqcn; // Fully-qualified class name. Identifies uniquely any class in the project.
#ifdef TOOLS_ENABLED
- String doc_description;
- String doc_brief_description;
- Vector<Pair<String, String>> doc_tutorials;
+ ClassDocData doc_data;
// EnumValue docs are parsed after itself, so we need a method to add/modify the doc property later.
- void set_enum_value_doc(const StringName &p_name, const String &p_doc_description) {
+ void set_enum_value_doc_data(const StringName &p_name, const MemberDocData &p_doc_data) {
ERR_FAIL_INDEX(members_indices[p_name], members.size());
- members.write[members_indices[p_name]].enum_value.doc_description = p_doc_description;
+ members.write[members_indices[p_name]].enum_value.doc_data = p_doc_data;
}
#endif // TOOLS_ENABLED
@@ -753,7 +767,9 @@ public:
members.push_back(Member(p_enum_value));
}
void add_member_group(AnnotationNode *p_annotation_node) {
- members_indices[p_annotation_node->export_info.name] = members.size();
+ // Avoid name conflict. See GH-78252.
+ StringName name = vformat("@group_%d_%s", members.size(), p_annotation_node->export_info.name);
+ members_indices[name] = members.size();
members.push_back(Member(p_annotation_node));
}
@@ -764,7 +780,7 @@ public:
struct ConstantNode : public AssignableNode {
#ifdef TOOLS_ENABLED
- String doc_description;
+ MemberDocData doc_data;
#endif // TOOLS_ENABLED
ConstantNode() {
@@ -819,7 +835,7 @@ public:
LambdaNode *source_lambda = nullptr;
#ifdef TOOLS_ENABLED
Vector<Variant> default_arg_values;
- String doc_description;
+ MemberDocData doc_data;
#endif // TOOLS_ENABLED
bool resolved_signature = false;
@@ -832,9 +848,7 @@ public:
struct GetNodeNode : public ExpressionNode {
String full_path;
-#ifdef DEBUG_ENABLED
bool use_dollar = true;
-#endif
GetNodeNode() {
type = GET_NODE;
@@ -843,19 +857,24 @@ public:
struct IdentifierNode : public ExpressionNode {
StringName name;
+#ifdef DEBUG_ENABLED
+ SuiteNode *suite = nullptr; // The block in which the identifier is used.
+#endif
enum Source {
UNDEFINED_SOURCE,
FUNCTION_PARAMETER,
- LOCAL_CONSTANT,
LOCAL_VARIABLE,
+ LOCAL_CONSTANT,
LOCAL_ITERATOR, // `for` loop iterator.
LOCAL_BIND, // Pattern bind.
- MEMBER_SIGNAL,
MEMBER_VARIABLE,
- STATIC_VARIABLE,
MEMBER_CONSTANT,
+ MEMBER_FUNCTION,
+ MEMBER_SIGNAL,
+ MEMBER_CLASS,
INHERITED_VARIABLE,
+ STATIC_VARIABLE,
};
Source source = UNDEFINED_SOURCE;
@@ -1006,7 +1025,7 @@ public:
Vector<ParameterNode *> parameters;
HashMap<StringName, int> parameters_indices;
#ifdef TOOLS_ENABLED
- String doc_description;
+ MemberDocData doc_data;
#endif // TOOLS_ENABLED
SignalNode() {
@@ -1211,7 +1230,7 @@ public:
int assignments = 0;
bool is_static = false;
#ifdef TOOLS_ENABLED
- String doc_description;
+ MemberDocData doc_data;
#endif // TOOLS_ENABLED
VariableNode() {
@@ -1486,12 +1505,12 @@ private:
ExpressionNode *parse_yield(ExpressionNode *p_previous_operand, bool p_can_assign);
ExpressionNode *parse_invalid_token(ExpressionNode *p_previous_operand, bool p_can_assign);
TypeNode *parse_type(bool p_allow_void = false);
+
#ifdef TOOLS_ENABLED
- // Doc comments.
int class_doc_line = 0x7FFFFFFF;
bool has_comment(int p_line, bool p_must_be_doc = false);
- String get_doc_comment(int p_line, bool p_single_line = false);
- void get_class_doc_comment(int p_line, String &p_brief, String &p_desc, Vector<Pair<String, String>> &p_tutorials, bool p_inner_class);
+ MemberDocData parse_doc_comment(int p_line, bool p_single_line = false);
+ ClassDocData parse_class_doc_comment(int p_line, bool p_inner_class, bool p_single_line = false);
#endif // TOOLS_ENABLED
public: