model: add missing service to retrieve a AClassDef from a MClassDef.
authorAlexandre Terrasa <alexandre@moz-code.org>
Tue, 21 Apr 2015 20:24:18 +0000 (16:24 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Tue, 21 Apr 2015 20:24:18 +0000 (16:24 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/modelize/modelize_class.nit

index 3503bd0..5fd0381 100644 (file)
@@ -448,6 +448,14 @@ redef class ModelBuilder
 
        # Registration of the nclassdef associated to each mclassdef
        private var mclassdef2nclassdef = new HashMap[MClassDef, AClassdef]
+
+       # Retrieve the associated AST node of a mclassdef.
+       #
+       # This method is used to associate model entity with syntactic entities.
+       # If the class definition is not associated with a node, returns `null`.
+       fun mclassdef2node(mclassdef: MClassDef): nullable AClassdef do
+               return mclassdef2nclassdef.get_or_null(mclassdef)
+       end
 end
 
 redef class AModule