model_filters: allow copy of filter options
authorAlexandre Terrasa <alexandre@moz-code.org>
Tue, 15 May 2018 16:50:11 +0000 (12:50 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 14 Jun 2018 20:33:09 +0000 (16:33 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/model/model_filters.nit

index 85f1042..0d47a92 100644 (file)
@@ -41,6 +41,22 @@ import parse_annotations
 # ~~~
 class ModelFilter
 
+       # Initialize `self` by copying the options from another `filter`
+       init from(filter: ModelFilter) do
+               init(
+                       min_visibility = filter.min_visibility,
+                       accept_fictive = filter.accept_fictive,
+                       accept_test = filter.accept_test,
+                       accept_redef = filter.accept_redef,
+                       accept_extern = filter.accept_extern,
+                       accept_example = filter.accept_example,
+                       accept_attribute = filter.accept_attribute,
+                       accept_empty_doc = filter.accept_empty_doc,
+                       accept_inherited = filter.accept_inherited,
+                       accept_full_name = filter.accept_full_name
+               )
+       end
+
        # Accept `mentity` based on all the options from `self`?
        #
        # If one of the filter returns `false` then the `mentity` is not accepted.