Merge pull request #85487 from vnen/gdscript-static-register-annotations

GDScript: Make annotations register statically in parser
This commit is contained in:
Yuri Sizov 2023-12-19 13:02:09 +01:00
commit a6f806f8da
2 changed files with 40 additions and 36 deletions

View file

@ -1370,7 +1370,7 @@ private:
AnnotationAction apply = nullptr;
MethodInfo info;
};
HashMap<StringName, AnnotationInfo> valid_annotations;
static HashMap<StringName, AnnotationInfo> valid_annotations;
List<AnnotationNode *> annotation_stack;
typedef ExpressionNode *(GDScriptParser::*ParseFunction)(ExpressionNode *p_previous_operand, bool p_can_assign);
@ -1470,7 +1470,7 @@ private:
SuiteNode *parse_suite(const String &p_context, SuiteNode *p_suite = nullptr, bool p_for_lambda = false);
// Annotations
AnnotationNode *parse_annotation(uint32_t p_valid_targets);
bool register_annotation(const MethodInfo &p_info, uint32_t p_target_kinds, AnnotationAction p_apply, const Vector<Variant> &p_default_arguments = Vector<Variant>(), bool p_is_vararg = false);
static bool register_annotation(const MethodInfo &p_info, uint32_t p_target_kinds, AnnotationAction p_apply, const Vector<Variant> &p_default_arguments = Vector<Variant>(), bool p_is_vararg = false);
bool validate_annotation_arguments(AnnotationNode *p_annotation);
void clear_unused_annotations();
bool tool_annotation(const AnnotationNode *p_annotation, Node *p_target, ClassNode *p_class);