From f0ce23b50400cabe1104928de40c0bf5cd87e8cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Tue, 22 Aug 2017 13:49:08 -0400 Subject: [PATCH] neo_doxygen: remove ambiguity in the use of Location MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- contrib/neo_doxygen/src/doxml/entitydef.nit | 4 ++-- contrib/neo_doxygen/src/model/class_compound.nit | 2 +- contrib/neo_doxygen/src/model/graph.nit | 12 ++++++------ contrib/neo_doxygen/src/model/location.nit | 1 - contrib/neo_doxygen/src/model/module_compound.nit | 2 +- .../src/tests/neo_doxygen_file_compound.nit | 10 +++++----- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/contrib/neo_doxygen/src/doxml/entitydef.nit b/contrib/neo_doxygen/src/doxml/entitydef.nit index 0f83aa1..6e43b24 100644 --- a/contrib/neo_doxygen/src/doxml/entitydef.nit +++ b/contrib/neo_doxygen/src/doxml/entitydef.nit @@ -57,8 +57,8 @@ abstract class EntityDefListener end # Parse the attributes of a `location` element. - protected fun get_location(atts: Attributes): Location do - var location = new Location + protected fun get_location(atts: Attributes): neo_doxygen::Location do + var location = new neo_doxygen::Location location.path = atts.value_ns("", "bodyfile") or else atts.value_ns("", "file") # Doxygen may indicate `[generated]`. diff --git a/contrib/neo_doxygen/src/model/class_compound.nit b/contrib/neo_doxygen/src/model/class_compound.nit index aca58cb..0fc5936 100644 --- a/contrib/neo_doxygen/src/model/class_compound.nit +++ b/contrib/neo_doxygen/src/model/class_compound.nit @@ -50,7 +50,7 @@ class ClassCompound class_def.name = name end - redef fun location=(location: nullable Location) do + redef fun location=(location) do super class_def.location = location end diff --git a/contrib/neo_doxygen/src/model/graph.nit b/contrib/neo_doxygen/src/model/graph.nit index 26c8e66..9df491a 100644 --- a/contrib/neo_doxygen/src/model/graph.nit +++ b/contrib/neo_doxygen/src/model/graph.nit @@ -167,13 +167,13 @@ abstract class Entity fun ns_separator: String do return "::" # Set the location of the entity in the source code. - fun location=(location: nullable Location) do + fun location=(location: nullable neo_doxygen::Location) do self["location"] = location end # Get the location of the entity in the source code. - fun location: nullable Location do - return self["location"].as(nullable Location) + fun location: nullable neo_doxygen::Location do + return self["location"].as(nullable neo_doxygen::Location) end # Put the entity in the graph. @@ -202,12 +202,12 @@ abstract class CodeBlock super Entity init do - self["location"] = new Location + self["location"] = new neo_doxygen::Location end - redef fun location=(location: nullable Location) do + redef fun location=(location) do if location == null then - super(new Location) + super(new neo_doxygen::Location) else super end diff --git a/contrib/neo_doxygen/src/model/location.nit b/contrib/neo_doxygen/src/model/location.nit index 576a087..4e58af0 100644 --- a/contrib/neo_doxygen/src/model/location.nit +++ b/contrib/neo_doxygen/src/model/location.nit @@ -15,7 +15,6 @@ # This module is used to model locations in source files. module location -import json::static import json # A location inside a source file. diff --git a/contrib/neo_doxygen/src/model/module_compound.nit b/contrib/neo_doxygen/src/model/module_compound.nit index 188d4c1..08b8205 100644 --- a/contrib/neo_doxygen/src/model/module_compound.nit +++ b/contrib/neo_doxygen/src/model/module_compound.nit @@ -46,7 +46,7 @@ class FileCompound super end - redef fun location=(location: nullable Location) do + redef fun location=(location) do super for m in inner_namespaces do m.location = location end diff --git a/contrib/neo_doxygen/src/tests/neo_doxygen_file_compound.nit b/contrib/neo_doxygen/src/tests/neo_doxygen_file_compound.nit index 3b1f6a4..a9dae43 100644 --- a/contrib/neo_doxygen/src/tests/neo_doxygen_file_compound.nit +++ b/contrib/neo_doxygen/src/tests/neo_doxygen_file_compound.nit @@ -26,11 +26,11 @@ var c_ns = new Namespace(graph) var d_ns = new Namespace(graph) var buffer = new Buffer var root_ns = graph.by_id[""].as(Namespace) -var location: Location +var location file.name = "Bar.java" file.model_id = "_Bar_8java" -location = new Location +location = new neo_doxygen::Location location.path = "a/b/Bar.java" file.location = location file.declare_class("classa_b_bar", "a::b::Bar", "package") @@ -41,7 +41,7 @@ file.put_in_graph file_2.name = "Bar.java" file_2.model_id = "_Bar_8java_2" -location = new Location +location = new neo_doxygen::Location location.path = "Bar.java" file_2.location = location file_2.declare_namespace("namespacec", "c") @@ -50,7 +50,7 @@ file_2.put_in_graph bar_class.model_id = "classa_b_bar" bar_class.name = "Bar" -location = new Location +location = new neo_doxygen::Location location.path = "a/b/Bar.class" location.line_start = 5 location.column_start = 1 @@ -61,7 +61,7 @@ bar_class.put_in_graph baz_class.model_id = "classbaz" baz_class.name = "Baz" -location = new Location +location = new neo_doxygen::Location location.path = "Baz.jar" baz_class.location = location baz_class.put_in_graph -- 1.7.9.5