syntax: remove local variable masking
[nit.git] / src / nitdoc.nit
index 5434df0..dfd5ec8 100644 (file)
@@ -58,7 +58,6 @@ special AbstractCompiler
        # Write the content to a new file
        fun write_to(filename: String)
        do
-               print "Generate {filename}"
                var f = new OFStream.open(filename)
                for s in _stage_context.content do
                        f.write(s)
@@ -96,6 +95,7 @@ special AbstractCompiler
        # Generate common files (frames, index, overview)
        fun extract_other_doc
        do
+               info("Generating other files",1)
                _module = null
                inside_mode = false
                intrude_mode = false
@@ -247,6 +247,7 @@ special AbstractCompiler
 
        init
        do
+               keep_ast = true
                super("nitdoc")
                option_context.add_option(opt_dir)
        end
@@ -402,7 +403,7 @@ special MMEntity
        do
                var m = module
                if not need_doc(dctx) then m = global.intro.module
-               var m = dctx.known_owner_of(m)
+               m = dctx.known_owner_of(m)
                if m == dctx.module then
                        return "<a href=\"#{html_anchor}\">{self}</a>"
                else
@@ -454,10 +455,10 @@ special MMEntity
                var res = new Buffer
                res.append(signature.to_html(dctx))
                var s = self
-               if s.node != null then
-                       if s.node isa ADeferredMethPropdef then
+               if s isa MMMethod then
+                       if s.is_abstract then
                                res.append(" is abstract")
-                       else if s.node isa AInternMethPropdef then
+                       else if s.is_intern then
                                res.append(" is intern")
                        end
                end
@@ -491,15 +492,13 @@ special MMEntity
        redef fun doc
        do
                var n = node
-               if n == null or not node isa PPropdef then
+               if n == null or not n isa APropdef then
                        return null
                end
-               assert n isa PPropdef
                var d = n.n_doc
                if d == null then
                        return null
                end
-               assert d isa ADoc
                if d.n_comment.is_empty then
                        return null
                else
@@ -508,10 +507,10 @@ special MMEntity
        end
 end
 redef class MMMethod
-       redef fun kind do return if global.is_init then "init" else "meth"
+       redef fun kind do return if global.is_init then "init" else "fun"
 end
 redef class MMAttribute
-       redef fun kind do return "attr"
+       redef fun kind do return "var"
 end
 redef class MMTypeProperty
        redef fun kind do return "type"
@@ -521,6 +520,7 @@ redef class MMSrcModule
        # Extract and generate html file for the module
        fun extract_module_doc(dctx: DocContext)
        do
+               dctx.info("Generating HTML for module {name}",1)
                dctx.register(self)
 
                dctx.clear
@@ -658,12 +658,10 @@ redef class MMSrcModule
                        return null
                end
                var np = n.n_packagedecl
-               assert np isa APackagedecl
                var d = np.n_doc
                if d == null then
                        return null
                end
-               assert d isa ADoc
                if d.n_comment.is_empty then
                        return null
                else
@@ -699,7 +697,7 @@ special MMEntity
        do
                var m = module
                if not need_doc(dctx) then m = global.module
-               var m = dctx.known_owner_of(m)
+               m = dctx.known_owner_of(m)
                if m == dctx.module then
                        return "<a href=\"#{html_anchor}\">{self}</a>"
                else
@@ -906,7 +904,6 @@ special MMEntity
                        # skip pass 1 because constructors are not inherited
                        var cmap = new HashMap[MMLocalClass, Array[MMLocalProperty]]
                        var mmap = new HashMap[MMModule, Array[MMLocalProperty]]
-                       var props = new Array[MMLocalClass]
                        for c in che.greaters do
                                if c isa MMSrcLocalClass then
                                        var km = dctx.known_owner_of(c.module)
@@ -964,7 +961,6 @@ special MMEntity
                end
 
                var mmap = new HashMap[MMModule, Array[MMLocalProperty]]
-               var props = new Array[MMLocalClass]
                for c in crhe.order do
                        if module.mhe <= c.module or dctx.owned_modules.has(c.module) or not c isa MMSrcLocalClass then continue
                        var km = dctx.known_owner_of(c.module)
@@ -1071,16 +1067,14 @@ redef class MMSrcLocalClass
 
        redef fun doc
        do
-               var n = nodes.first
-               if not n isa AClassdef then
+               var n = node
+               if not n isa AStdClassdef then
                        return null
                end
-               assert n isa AClassdef
                var d = n.n_doc
                if d == null then
                        return null
                end
-               assert d isa ADoc
                if d.n_comment.is_empty then
                        return null
                else