Skip to content

Commit

Permalink
dunno why there are no footprints for private and protected signals a…
Browse files Browse the repository at this point in the history
…nd members...
  • Loading branch information
Lazy-Rabbit-2001 committed Oct 16, 2024
1 parent 78d7189 commit 0ab9d2b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
12 changes: 10 additions & 2 deletions doc/tools/make_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@
"This method accepts any number of arguments after the ones described here.",
"This method is used to construct a type.",
"This method doesn't need an instance to be called, so it can be called directly using the class name.",
"This method describes a valid operator to use with this type as left-hand operand.",
"This exported signal can only be accessed from the inspector or the class that contains the signal.",
"This exported signal can only be accessed from the inspector or the class that contains the signal, or whose derived classes.",
"This exported property can only be accessed from the inspector or the class that contains the signal.",
"This exported property can only be accessed from the inspector or the class that contains the signal, or whose derived classes.",
"This value is an integer composed as a bitmask of the following flags.",
"This method describes a valid operator to use with this type as left-hand operand.",
"No return value.",
"There is currently no description for this class. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!",
"There is currently no description for this signal. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!",
Expand Down Expand Up @@ -207,6 +207,8 @@ def parse_class(self, class_root: ET.Element, filepath: str) -> None:
assert property.tag == "member"

property_name = property.attrib["name"]
qualifiers = property.get("qualifiers")

if property_name in class_def.properties:
print_error(f'{class_name}.xml: Duplicate property "{property_name}".', self)
continue
Expand Down Expand Up @@ -373,6 +375,7 @@ def parse_class(self, class_root: ET.Element, filepath: str) -> None:
assert signal.tag == "signal"

signal_name = signal.attrib["name"]
qualifiers = property.get("qualifiers")

if signal_name in class_def.signals:
print_error(f'{class_name}.xml: Duplicate signal "{signal_name}".', self)
Expand Down Expand Up @@ -1063,6 +1066,11 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
else:
ref = f":ref:`{property_def.name}<class_{class_name}_property_{property_def.name}>`"
ml.append((type_rst, ref, default))

qualifiers = property_def.qualifiers
if qualifiers is not None:
for q in qualifiers.split():
ml.append((f" |{q}|"))

format_table(f, ml, True)

Expand Down Expand Up @@ -1585,7 +1593,7 @@ def make_method_signature(
ret_type = definition.return_type.to_rst(state)

qualifiers = None
if isinstance(definition, (MethodDef, AnnotationDef)):
if isinstance(definition, (MethodDef, AnnotationDef, SignalDef)):
qualifiers = definition.qualifiers

out = ""
Expand Down
17 changes: 7 additions & 10 deletions modules/gdscript/editor/gdscript_docgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,12 @@ void GDScriptDocGen::_generate_docs(GDScript *p_script, const GDP::ClassNode *p_
signal_doc.deprecated_message = m_signal->doc_data.deprecated_message;
signal_doc.is_experimental = m_signal->doc_data.is_experimental;
signal_doc.experimental_message = m_signal->doc_data.experimental_message;

for (const GDP::ParameterNode *p : m_signal->parameters) {
DocData::ArgumentDoc arg_doc;
arg_doc.name = p->identifier->name;
_doctype_from_gdtype(p->get_datatype(), arg_doc.type, arg_doc.enumeration);
signal_doc.arguments.push_back(arg_doc);
}
switch (m_signal->access_restriction) {
case GDP::Node::ACCESS_RESTRICTION_PRIVATE:
signal_doc.qualifiers = "private_signal";
Expand All @@ -465,13 +470,6 @@ void GDScriptDocGen::_generate_docs(GDScript *p_script, const GDP::ClassNode *p_
break;
}

for (const GDP::ParameterNode *p : m_signal->parameters) {
DocData::ArgumentDoc arg_doc;
arg_doc.name = p->identifier->name;
_doctype_from_gdtype(p->get_datatype(), arg_doc.type, arg_doc.enumeration);
signal_doc.arguments.push_back(arg_doc);
}

doc.signals.push_back(signal_doc);
} break;

Expand All @@ -492,8 +490,6 @@ void GDScriptDocGen::_generate_docs(GDScript *p_script, const GDP::ClassNode *p_
prop_doc.deprecated_message = m_var->doc_data.deprecated_message;
prop_doc.is_experimental = m_var->doc_data.is_experimental;
prop_doc.experimental_message = m_var->doc_data.experimental_message;
_doctype_from_gdtype(m_var->get_datatype(), prop_doc.type, prop_doc.enumeration);

if (m_var->exported) {
switch (m_var->access_restriction) {
case GDP::Node::ACCESS_RESTRICTION_PRIVATE:
Expand All @@ -506,6 +502,7 @@ void GDScriptDocGen::_generate_docs(GDScript *p_script, const GDP::ClassNode *p_
break;
}
}
_doctype_from_gdtype(m_var->get_datatype(), prop_doc.type, prop_doc.enumeration);

switch (m_var->property) {
case GDP::VariableNode::PROP_NONE:
Expand Down

0 comments on commit 0ab9d2b

Please sign in to comment.