serialization: don't throw missing attribute error if there is a default value
[nit.git] / src / frontend / no_warning.nit
index 931440e..97efb63 100644 (file)
@@ -30,20 +30,22 @@ private class NoWarningPhase
        do
                # Get the mmodule
                var mmodule = nmodule.mmodule
-               assert mmodule != null
+               if mmodule == null then return
 
                var source = nmodule.location.file
 
-               # If no decl block then quit
                var nmoduledecl = nmodule.n_moduledecl
-               if nmoduledecl == null then
+               if nmoduledecl == null or nmoduledecl.n_doc == null then
                        # Disable `missing-doc` if there is no `module` clause
                        # Rationale: the presence of a `module` clause is a good heuristic to
                        # discriminate quick and dirty prototypes from nice and clean modules
                        if source != null then toolcontext.warning_blacklist[source].add("missing-doc")
-                       return
+
                end
 
+               # If no decl block then quit
+               if nmoduledecl == null then return
+
                var modelbuilder = toolcontext.modelbuilder
 
                # Disable `missing-doc` for `test_suite`
@@ -58,20 +60,20 @@ private class NoWarningPhase
                if annots.is_empty then return
 
                if source == null then
-                       modelbuilder.warning(annots.first, "file-less-module", "Warning: annotation `{name}` does not currently work on file-less modules.")
+                       modelbuilder.warning(annots.first, "file-less-module", "Warning: `{name}` does not currently work on file-less modules.")
                        return
                end
 
                for annot in annots do
                        var args = annot.n_args
                        if args.is_empty then
-                               modelbuilder.error(annot, "Annotation error: `{name}` needs a list of warnings. Use `\"all\"` to disable all warnings.")
+                               modelbuilder.error(annot, "Syntax Error: `{name}` expects a list of warnings. Use `\"all\"` to disable all warnings.")
                                continue
                        end
                        for arg in args do
                                var tag = arg.as_string
                                if tag == null then
-                                       modelbuilder.error(arg, "Annotation error: `{name}` expects String as arguments.")
+                                       modelbuilder.error(arg, "Syntax Error: `{name}` expects String as arguments.")
                                        continue
                                end