nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src: cleanup importations
[nit.git]
/
src
/
check_annotation.nit
diff --git
a/src/check_annotation.nit
b/src/check_annotation.nit
index
38b179f
..
367ba4d
100644
(file)
--- a/
src/check_annotation.nit
+++ b/
src/check_annotation.nit
@@
-19,7
+19,7
@@
module check_annotation
import phase
module check_annotation
import phase
-import annotation
+private import annotation
redef class ToolContext
var check_annotation_phase: Phase = new CheckAnnotationPhase(self, null)
redef class ToolContext
var check_annotation_phase: Phase = new CheckAnnotationPhase(self, null)
@@
-51,14
+51,23
@@
private class CheckAnnotationPhase
# Get all the new annotations
var annots = nmoduledecl.get_annotations("new_annotation")
# Get all the new annotations
var annots = nmoduledecl.get_annotations("new_annotation")
+ var super_mmodules = declared_annotations.lookup_all_modules(mmodule, private_visibility)
+
# Add each new annotations in the map
for annot in annots do
var name = annot.arg_as_id(modelbuilder)
if name == null then continue
# Add each new annotations in the map
for annot in annots do
var name = annot.arg_as_id(modelbuilder)
if name == null then continue
+ for m in super_mmodules do
+ if declared_annotations[m].has(name) then
+ modelbuilder.warning(annot, "Warning: an annotation `{name}` is already declared in module `{m}`")
+ break label
+ end
+ end
+
declared_annotations[mmodule].add(name)
#annot.debug "add {mmodule}: {name}"
declared_annotations[mmodule].add(name)
#annot.debug "add {mmodule}: {name}"
- end
+ end label
end
# Raw new-line separated list of primitive annotation
end
# Raw new-line separated list of primitive annotation
@@
-72,6
+81,8
@@
noinit
readonly
writable
cached
readonly
writable
cached
+nosuper
+old_style_init
pkgconfig
c_compiler_option
pkgconfig
c_compiler_option