X-Git-Url: http://nitlanguage.org diff --git a/src/neo.nit b/src/neo.nit index 1bed82a..5e28695 100644 --- a/src/neo.nit +++ b/src/neo.nit @@ -43,7 +43,6 @@ # `MGroup` # # * labels: `MGroup`, `model_name` and `MEntity`. -# * `full_name`: fully qualified name. # * `(:MGroup)-[:PROJECT]->(:MProject)`: associated project. # * `(:MGroup)-[:PARENT]->(:MGroup)`: parent group. Does not exist for the root # group. @@ -55,7 +54,6 @@ # `MModule` # # * labels: `MModule`, `model_name` and `MEntity`. -# * `full_name`: fully qualified name. # * `location`: origin of the definition. SEE: `Location.to_s` # * `(:MModule)-[:IMPORTS]->(:MModule)`: modules that are imported directly. # * `(:MModule)-[:INTRODUCES]->(:MClass)`: all by classes introduced by this @@ -66,7 +64,6 @@ # `MClass` # # * labels: `MClass`, `model_name` and `MEntity`. -# * `full_name`: fully qualified name. # * `kind`: kind of the class (`interface`, `abstract class`, etc.) # * `visibility`: visibility of the class. # * `parameter_names`: JSON array listing the name of each formal generic @@ -96,7 +93,6 @@ # * labels: `MProperty`, `model_name` and `MEntity`. Must also have `MMethod`, # `MAttribute` `MVirtualTypeProp` or `MInnerClass`, depending on the class of # the represented entity. -# * `full_name`: fully qualified name. # * `visibility`: visibility of the property. # * `is_init`: Indicates if the property is a constructor. Exists only if the # node is a `MMethod`. @@ -369,7 +365,10 @@ class NeoModel node.labels.add "MEntity" node.labels.add model_name node["name"] = mentity.name - if mentity.mdoc != null then node["mdoc"] = new JsonArray.from(mentity.mdoc.content) + if mentity.mdoc != null then + node["mdoc"] = new JsonArray.from(mentity.mdoc.content) + node["mdoc_location"] = mentity.mdoc.location.to_s + end return node end @@ -403,7 +402,6 @@ class NeoModel private fun mgroup_node(mgroup: MGroup): NeoNode do var node = make_node(mgroup) node.labels.add "MGroup" - node["full_name"] = mgroup.full_name var parent = mgroup.parent node.out_edges.add(new NeoEdge(node, "PROJECT", to_node(mgroup.mproject))) if parent != null then @@ -442,7 +440,6 @@ class NeoModel private fun mmodule_node(mmodule: MModule): NeoNode do var node = make_node(mmodule) node.labels.add "MModule" - node["full_name"] = mmodule.full_name node["location"] = mmodule.location.to_s for parent in mmodule.in_importation.direct_greaters do node.out_edges.add(new NeoEdge(node, "IMPORTS", to_node(parent))) @@ -486,7 +483,6 @@ class NeoModel private fun mclass_node(mclass: MClass): NeoNode do var node = make_node(mclass) node.labels.add "MClass" - node["full_name"] = mclass.full_name node["kind"] = mclass.kind.to_s node["visibility"] = mclass.visibility.to_s if not mclass.mparameters.is_empty then @@ -568,7 +564,6 @@ class NeoModel private fun mproperty_node(mproperty: MProperty): NeoNode do var node = make_node(mproperty) node.labels.add "MProperty" - node["full_name"] = mproperty.full_name node["visibility"] = mproperty.visibility.to_s if mproperty isa MMethod then node.labels.add "MMethod" @@ -850,6 +845,7 @@ class NeoModel node.labels.add "MParameter" node["name"] = mparameter.name node["is_vararg"] = mparameter.is_vararg + node["is_default"] = mparameter.is_default node.out_edges.add(new NeoEdge(node, "TYPE", to_node(mparameter.mtype))) return node end @@ -865,25 +861,15 @@ class NeoModel var name = node["name"].to_s var mtype = to_mtype(model, node.out_nodes("TYPE").first) var is_vararg = node["is_vararg"].as(Bool) - var mparameter = new MParameter(name, mtype, is_vararg) + var is_default = node["is_default"].as(Bool) + var mparameter = new MParameter(name, mtype, is_vararg, is_default) mentities[node.id.as(Int)] = mparameter return mparameter end # Get a `Location` from its string representation. private fun to_location(loc: String): Location do - #TODO filepath - var parts = loc.split_with(":") - var file = new SourceFile.from_string(parts[0], "") - var pos = parts[1].split_with("--") - var pos1 = pos[0].split_with(",") - var pos2 = pos[1].split_with(",") - var line_s = pos1[0].to_i - var line_e = pos2[0].to_i - var column_s = pos1[1].to_i - var column_e = 0 - if pos2.length == 2 then pos2[1].to_i - return new Location(file, line_s, line_e, column_s, column_e) + return new Location.from_string(loc) end # Get a `MVisibility` from its string representation. @@ -927,7 +913,8 @@ class NeoModel for e in node["mdoc"].as(JsonArray) do lines.add e.to_s#.replace("\n", "\\n") end - var mdoc = new MDoc + var location = to_location(node["mdoc_location"].to_s) + var mdoc = new MDoc(location) mdoc.content.add_all(lines) mdoc.original_mentity = mentity mentity.mdoc = mdoc