src: use `get_annotations` instead of `collect_annotations_by_name`
authorJean Privat <jean@pryen.org>
Mon, 28 Jul 2014 20:09:51 +0000 (16:09 -0400)
committerJean Privat <jean@pryen.org>
Thu, 31 Jul 2014 12:50:11 +0000 (08:50 -0400)
The former does what is implied, the second is a deep search

Update the comment on the latter.

Signed-off-by: Jean Privat <jean@pryen.org>

src/android_annotations.nit
src/parser_util.nit
src/serialization_phase.nit

index 7e9f43a..799a548 100644 (file)
@@ -109,7 +109,7 @@ redef class ModelBuilder
                        var amod = mmodule2nmodule[mmod]
                        var module_decl = amod.n_moduledecl
                        if module_decl == null then continue
-                       var aas = module_decl.collect_annotations_by_name(name)
+                       var aas = module_decl.get_annotations(name)
                        annotations.add_all aas
                end
                return annotations
@@ -123,7 +123,7 @@ redef class ModelBuilder
                        var amod = mmodule2nmodule[mmodule]
                        var module_decl = amod.n_moduledecl
                        if module_decl != null then
-                               var annotations = module_decl.collect_annotations_by_name(name)
+                               var annotations = module_decl.get_annotations(name)
                                if annotations.length == 1 then
                                        return annotations.first
                                else if annotations.length > 1 then
index 54ccab2..ff97a78 100644 (file)
@@ -248,7 +248,7 @@ class InjectedLexer
 end
 
 redef class ANode
-       # Return an array of tokens that match a given text
+       # Do a deep search and return an array of tokens that match a given text
        fun collect_tokens_by_text(text: String): Array[Token]
        do
                var v = new CollectTokensByTextVisitor(text)
@@ -256,7 +256,7 @@ redef class ANode
                return v.result
        end
 
-       # Return an array of node that are annotated
+       # Do a deep search and return an array of node that are annotated
        # The attached node can be retrieved by two invocation of parent
        fun collect_annotations_by_name(name: String): Array[AAnnotation]
        do
index c3b0dc0..ec472c2 100644 (file)
@@ -64,7 +64,7 @@ private class SerializationPhasePreModel
                var auto_serializable_nclassdefs = new Array[AStdClassdef]
                for nclassdef in nmodule.n_classdefs do
                        if nclassdef isa AStdClassdef and
-                          not nclassdef.collect_annotations_by_name("auto_serializable").is_empty then
+                          not nclassdef.get_annotations("auto_serializable").is_empty then
                                auto_serializable_nclassdefs.add nclassdef
                        end
                end