nitdoc: display right location for empty comments
authorAlexandre Terrasa <alexandre@moz-code.org>
Sat, 15 Feb 2014 05:01:35 +0000 (00:01 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 20 Feb 2014 19:11:59 +0000 (14:11 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/nitdoc.nit

index ff254b5..eb92064 100644 (file)
@@ -1824,11 +1824,13 @@ redef class AModule
                return ""
        end
 
+       # The doc location or the first line of the block if doc node is null
        private fun doc_location: Location do
                if n_moduledecl != null and n_moduledecl.n_doc != null then
                        return n_moduledecl.n_doc.location
                end
-               return location
+               var l = location
+               return new Location(l.file, l.line_start, l.line_start, l.column_start, l.column_start)
        end
 end
 
@@ -1848,9 +1850,11 @@ redef class AStdClassdef
                return ""
        end
 
+       # The doc location or the first line of the block if doc node is null
        private fun doc_location: Location do
                if n_doc != null then return n_doc.location
-               return location
+               var l = location
+               return new Location(l.file, l.line_start, l.line_start, l.column_start, l.column_start)
        end
 end
 
@@ -1872,7 +1876,9 @@ redef class APropdef
 
        private fun doc_location: Location do
                if n_doc != null then return n_doc.location
-               return location
+               var l = location
+               return new Location(l.file, l.line_start, l.line_start, l.column_start, l.column_start)
+
        end
 end