nitc: add new module annotation `is generated`
authorJean Privat <jean@pryen.org>
Fri, 10 Feb 2017 13:28:05 +0000 (08:28 -0500)
committerJean Privat <jean@pryen.org>
Fri, 10 Feb 2017 13:28:05 +0000 (08:28 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/frontend/check_annotation.nit
src/loader.nit
src/model/mmodule.nit

index 680fa67..3dd8042 100644 (file)
@@ -94,6 +94,7 @@ abstract
 intern
 extern
 no_warning
+generated
 
 auto_inspect
 
index 32749aa..37812f7 100644 (file)
@@ -813,6 +813,8 @@ redef class ModelBuilder
                        end
                        # Is the module a test suite?
                        mmodule.is_test_suite = not decl.get_annotations("test_suite").is_empty
+                       # Is the module generated?
+                       mmodule.is_generated = not decl.get_annotations("generated").is_empty
                end
        end
 
index 44eaffb..9d1fb9c 100644 (file)
@@ -251,6 +251,12 @@ class MModule
        # Is `self` a unit test module used by `nitunit`?
        var is_test_suite: Bool = false is writable
 
+       # Is `self` a module generated by a tool?
+       #
+       # This flag has no effect on the semantic.
+       # It is only intended on software engineering software to discriminate computer-generated modules from human-written ones.
+       var is_generated: Bool = false is writable
+
        # Get the non-`is_fictive` module on which `self` is based on.
        #
        # On non-fictive module, this returns `self`.