Conversation
| let mut flags = DefinitionFlags::empty(); | ||
|
|
||
| for node in list.iter() { | ||
| if let Node::Annotation(annotation) = node { |
There was a problem hiding this comment.
Does node.annotations() always return a NodeList of Node::Annotation? Or can it return some other AST node?
Maybe, as a future improvement to the RBS crate API, we can make NodeList generic and then we might be able to not need to narrow the type.
Something like:
fn annotations() -> NodeList<Node::Annotation> {
}There was a problem hiding this comment.
Added panic() since the annotations node should not have any node other than annotation.
| assert_def_name_eq!(&context, def, "Baz"); | ||
| assert!(!def.flags().contains(DefinitionFlags::DEPRECATED)); | ||
| }); | ||
| } |
There was a problem hiding this comment.
Let's also add a test for classes with deprecation, similar to the module test — just to confirm both paths are covered.
There was a problem hiding this comment.
Changed the second example from module to class so that it tests class declaration too.
5b4d9f2 to
240d85a
Compare
| } | ||
|
|
||
| #[test] | ||
| fn flags_test_deprecation() { |
There was a problem hiding this comment.
Extracted tests for deprecation annotation detection.
RBS has
%a{deprecated}and%a{deprecated: message}annotation. This PR is to import the flags for class and module declarations.#87