import phase
redef class ToolContext
+ # Execute `AModule::do_simple_misc_analysis` on each module.
var simple_misc_analysis_phase: Phase = new SimpleMiscAnalysisPhase(self, null)
end
var toolcontext: ToolContext
- fun warning(node: ANode, msg: String)
+ fun warning(node: ANode, tag, msg: String)
do
- toolcontext.warning(node.hot_location, msg)
- end
-
- init(toolcontext: ToolContext)
- do
- self.toolcontext = toolcontext
+ toolcontext.warning(node.hot_location, tag, msg)
end
end
redef fun after_simple_misc(v)
do
if self.n_opar != null and self.n_params.is_empty then
- v.warning(self, "Warning: superfluous parentheses.")
+ v.warning(self, "parentheses", "Warning: superfluous parentheses.")
end
end
end
redef class AParExpr
redef fun warn_parentheses(v)
do
- v.warning(self, "Warning: superfluous parentheses.")
+ v.warning(self, "parentheses", "Warning: superfluous parentheses.")
end
end
redef fun after_simple_misc(v)
do
if n_exprs.is_empty then
- v.warning(self, "Warning: superfluous parentheses.")
+ v.warning(self, "parentheses", "Warning: superfluous parentheses.")
end
end
end
end
end
-redef class AContinueExpr
- redef fun after_simple_misc(v)
- do
- var e = n_expr
- if e != null then
- e.warn_parentheses(v)
- end
- end
-end
-
-redef class ABreakExpr
+redef class AEscapeExpr
redef fun after_simple_misc(v)
do
var e = n_expr
redef fun after_simple_misc(v)
do
if n_expr isa ATrueExpr then
- v.warning(self, "Warning: use 'loop' instead of 'while true do'.")
+ v.warning(self, "loop", "Warning: use `loop` instead of `while true do`.")
else
n_expr.warn_parentheses(v)
end
redef fun accept_simple_misc(v)
do
if v.once_count > 0 then
- v.warning(self, "Useless once in a once expression.")
+ v.warning(self, "nested-once", "Warning: useless once in a once expression.")
end
v.once_count = v.once_count + 1