Merge: engines: no more `super_inits` method used in old-style automatic init
[nit.git] / src / highlight.nit
index c9dec07..06075b4 100644 (file)
@@ -15,7 +15,6 @@
 # Highliting of Nit AST
 module highlight
 
-import modelize_property
 import frontend
 import html
 import pipeline
@@ -28,13 +27,13 @@ class HighlightVisitor
 
        # Is the HTML include a nested `<span class"{type_of_node}">` element for each `ANode` of the AST?
        # Used to have a really huge and verbose HTML (mainly for debug)
-       var with_ast writable = false
+       var with_ast = false is writable
 
        # The first line to generate, null if start at the first line
-       var first_line: nullable Int writable = null
+       var first_line: nullable Int = null is writable
 
        # The last line to generate, null if finish at the last line
-       var last_line: nullable Int writable = null
+       var last_line: nullable Int = null is writable
 
        init
        do
@@ -474,13 +473,11 @@ redef class MParameterType
        redef fun infobox(v)
        do
                var res = new HInfoBox(v, to_s)
-               var name = mclass.intro.parameter_names[rank]
                res.new_field("parameter type").append("{name} from class ").add mclass.intro.linkto
                return res
        end
        redef fun linkto
        do
-               var name = mclass.intro.parameter_names[rank]
                return (new HTMLTag("span")).text(name)
        end
 end
@@ -553,6 +550,7 @@ redef class Variable
        super HInfoBoxable
        redef fun infobox(v)
        do
+               var declared_type = self.declared_type
                if declared_type == null then
                        var res = new HInfoBox(v, "{name}")
                        res.new_field("local var").append("{name}")
@@ -666,9 +664,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 +674,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 +685,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 +697,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
@@ -857,7 +855,7 @@ redef class AType
        do
                var mt = mtype
                if mt == null then return null
-               if mt isa MNullableType then mt = mt.mtype
+               mt = mt.as_notnullable
                if mt isa MVirtualType or mt isa MParameterType then
                        res.add_class("nc_vt")
                end