model: add `MDoc::location`
authorJean Privat <jean@pryen.org>
Sat, 14 Mar 2015 05:13:53 +0000 (12:13 +0700)
committerJean Privat <jean@pryen.org>
Sat, 14 Mar 2015 05:13:53 +0000 (12:13 +0700)
Signed-off-by: Jean Privat <jean@pryen.org>

src/loader.nit
src/model/mdoc.nit
src/modelbuilder_base.nit

index 65e7c67..3bd8404 100644 (file)
@@ -385,7 +385,7 @@ redef class ModelBuilder
                var readme = dirpath2.join_path("README.md")
                if not readme.file_exists then readme = dirpath2.join_path("README")
                if readme.file_exists then
-                       var mdoc = new MDoc
+                       var mdoc = new MDoc(new Location(new SourceFile.from_string(readme, ""),0,0,0,0))
                        var s = new FileReader.open(readme)
                        while not s.eof do
                                mdoc.content.add(s.read_line)
index 2f8d045..4e8c565 100644 (file)
@@ -16,6 +16,7 @@
 module mdoc
 
 import model_base
+import location
 
 # Structured documentation of a `MEntity` object
 class MDoc
@@ -27,6 +28,9 @@ class MDoc
        # The entity where the documentation is originally attached to.
        # This gives some context to resolve identifiers or to run examples.
        var original_mentity: nullable MEntity = null is writable
+
+       # The original location of the doc for error messages
+       var location: Location
 end
 
 redef class MEntity
index 6cbcbef..9995338 100644 (file)
@@ -375,7 +375,7 @@ redef class ADoc
        do
                var res = mdoc_cache
                if res != null then return res
-               res = new MDoc
+               res = new MDoc(location)
                for c in n_comment do
                        var text = c.text
                        if text.length < 2 then