X-Git-Url: http://nitlanguage.org diff --git a/src/neo.nit b/src/neo.nit index eebd408..ce683de 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 @@ -94,20 +91,23 @@ # `MProperty` # # * labels: `MProperty`, `model_name` and `MEntity`. Must also have `MMethod`, -# `MAttribute` or `MVirtualTypeProp`, depending on the class of the represented -# entity. -# * `full_name`: fully qualified name. +# `MAttribute` `MVirtualTypeProp` or `MInnerClass`, depending on the class of +# the represented entity. # * `visibility`: visibility of the property. # * `is_init`: Indicates if the property is a constructor. Exists only if the # node is a `MMethod`. # * `(:MProperty)-[:INTRO_CLASSDEF]->(:MClassDef)`: classdef that introduces # the property. # +# Additional relationship for `MInnerClass`: +# +# * `(:MInnerClassDef)-[:NESTS]->(:MClass)`: actual inner class. +# # `MPropDef` # # * labels: `MPropDef`, `model_name` and `MEntity`. Must also have `MMethodDef`, -# `MAttributeDef` or `MVirtualTypeDef`, depending on the class of the -# represented entity. +# `MAttributeDef`, `MVirtualTypeDef` or `MInnerClassDef`, depending on the +# class of the represented entity. # * `location`: origin of the definition. SEE: `Location.to_s`. # * `(:MPropDef)-[:DEFINES]->(:MProperty)`: associated property. # @@ -130,6 +130,11 @@ # is bound in this definition. Exists only if this definition bound the virtual # type to an effective type. # +# Additional relationship for `MInnerClassDef`: +# +# * `(:MInnerClassDef)-[:NESTS]->(:MClassDef)`: actual inner class' +# definition. +# # `MType` # # * labels: `MType`, `model_name` and `MEntity`. Must also have `MClassType`, @@ -394,7 +399,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 @@ -433,7 +437,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))) @@ -477,7 +480,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 @@ -559,7 +561,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" @@ -568,6 +569,9 @@ class NeoModel node.labels.add "MAttribute" else if mproperty isa MVirtualTypeProp then node.labels.add "MVirtualTypeProp" + else if mproperty isa MInnerClass then + node.labels.add "MInnerClass" + node.out_edges.add(new NeoEdge(node, "NESTS", to_node(mproperty.inner))) end node.out_edges.add(new NeoEdge(node, "INTRO_CLASSDEF", to_node(mproperty.intro_mclassdef))) return node @@ -592,6 +596,9 @@ class NeoModel mprop = new MAttribute(intro_mclassdef, name, visibility) else if node.labels.has("MVirtualTypeProp") then mprop = new MVirtualTypeProp(intro_mclassdef, name, visibility) + else if node.labels.has("MInnerClass") then + var inner = to_mclass(model, node.out_nodes("NESTS").first) + mprop = new MInnerClass(intro_mclassdef, name, visibility, inner) end if mprop == null then print "not yet implemented to_mproperty for {node.labels.join(",")}" @@ -629,6 +636,9 @@ class NeoModel if bound != null then node.out_edges.add(new NeoEdge(node, "BOUND", to_node(bound))) end + else if mpropdef isa MInnerClassDef then + node.labels.add "MInnerClassDef" + node.out_edges.add(new NeoEdge(node, "NESTS", to_node(mpropdef.inner))) end return node end @@ -662,6 +672,11 @@ class NeoModel mentities[node.id.as(Int)] = mpropdef var bound = node.out_nodes("BOUND") if not bound.is_empty then mpropdef.bound = to_mtype(model, bound.first) + else if node.labels.has("MInnerClassDef") then + var inner = to_mclassdef(model, node.out_nodes("NESTS").first) + mpropdef = new MInnerClassDef(mclassdef, + mproperty.as(MInnerClass), location, inner) + mentities[node.id.as(Int)] = mpropdef end if mpropdef == null then print "not yet implemented to_mpropdef for {node.labels.join(",")}"