From: Jean Privat Date: Tue, 3 Jun 2014 13:47:59 +0000 (-0400) Subject: highlight: do not add html classes to unresolved local variables X-Git-Tag: v0.6.6~50^2~5 X-Git-Url: http://nitlanguage.org highlight: do not add html classes to unresolved local variables Eg. this avoid highlighting to only highlight the fist occurrence of `x` in the following AST if no semantic analysis is run ~~~ var x = 5 print x ~~~ Now, either none, or both `x` are identified as variables according to how mush semantic analysis is performed. Signed-off-by: Jean Privat --- diff --git a/src/highlight.nit b/src/highlight.nit index c9dec07..cd400bd 100644 --- a/src/highlight.nit +++ b/src/highlight.nit @@ -666,9 +666,9 @@ end redef class AVarFormExpr redef fun decorate_tag(v, res, token) do - res.add_class("nc_v") var variable = self.variable if variable == null then return null + res.add_class("nc_v") return variable.infobox(v) end end @@ -676,9 +676,9 @@ end redef class AVardeclExpr redef fun decorate_tag(v, res, token) do - res.add_class("nc_v") var variable = self.variable if variable == null then return null + res.add_class("nc_v") return variable.infobox(v) end end @@ -687,9 +687,9 @@ redef class AForExpr redef fun decorate_tag(v, res, token) do if not token isa TId then return null - res.add_class("nc_v") var vs = variables if vs == null then return null + res.add_class("nc_v") var idx = n_ids.index_of(token) var variable = vs[idx] return variable.infobox(v) @@ -699,11 +699,11 @@ end redef class AParam redef fun decorate_tag(v, res, token) do - res.add_class("nc_v") var mp = mparameter if mp == null then return null var variable = self.variable if variable == null then return null + res.add_class("nc_v") return variable.infobox(v) end end