nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge: Contract: Change mpropdef driving
[nit.git]
/
src
/
frontend
/
check_annotation.nit
diff --git
a/src/frontend/check_annotation.nit
b/src/frontend/check_annotation.nit
index
367ba4d
..
9dc9cfd
100644
(file)
--- a/
src/frontend/check_annotation.nit
+++ b/
src/frontend/check_annotation.nit
@@
-22,6
+22,7
@@
import phase
private import annotation
redef class ToolContext
private import annotation
redef class ToolContext
+ # Check for unknown annotation in each module
var check_annotation_phase: Phase = new CheckAnnotationPhase(self, null)
end
var check_annotation_phase: Phase = new CheckAnnotationPhase(self, null)
end
@@
-39,7
+40,7
@@
private class CheckAnnotationPhase
do
# Get the mmodule
var mmodule = nmodule.mmodule
do
# Get the mmodule
var mmodule = nmodule.mmodule
- assert mmodule != null
+ if mmodule == null then return
self.mmodule = mmodule
# If no decl block then quit
self.mmodule = mmodule
# If no decl block then quit
@@
-60,7
+61,7
@@
private class CheckAnnotationPhase
for m in super_mmodules do
if declared_annotations[m].has(name) then
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}`")
+ modelbuilder.warning(annot, "multiple-annotation-declarations", "Warning: an annotation `{name}` is already declared in module `{m}`.")
break label
end
end
break label
end
end
@@
-75,20
+76,45
@@
private class CheckAnnotationPhase
var primtives_annotations_list = """
new_annotation
var primtives_annotations_list = """
new_annotation
+conditional
+
+deprecated
fixed
lazy
noinit
readonly
writable
fixed
lazy
noinit
readonly
writable
-cached
+optional
+autoinit
+noautoinit
+lateinit
nosuper
old_style_init
nosuper
old_style_init
+abstract
+intern
+extern
+no_warning
+generated
+
+auto_inspect
pkgconfig
pkgconfig
-c_compiler_option
-c_linker_option
+cflags
+ldflags
+light_ffi
platform
platform
+
+test
+before
+before_all
+after
+after_all
+example
+
+expect
+ensure
+no_contract
"""
# Efficient set build from `primtives_annotations_list`
"""
# Efficient set build from `primtives_annotations_list`
@@
-103,7
+129,7
@@
platform
if primtives_annotations.has(name) then return
var mmodule = self.mmodule
if primtives_annotations.has(name) then return
var mmodule = self.mmodule
- assert mmodule != null
+ if mmodule == null then return
# Lazily build the full user-list
var annots = user_annotations.get_or_null(mmodule)
# Lazily build the full user-list
var annots = user_annotations.get_or_null(mmodule)
@@
-116,7
+142,7
@@
platform
if annots.has(name) then return
if annots.has(name) then return
- toolcontext.modelbuilder.warning(nat, "Warning: unknown annotation `{name}`")
+ toolcontext.modelbuilder.warning(nat, "unknown-annotation", "Warning: unknown annotation `{name}`.")
annots.add(name) # to avoid multiple errors on the same name
end
annots.add(name) # to avoid multiple errors on the same name
end