modelbuilder: mclass2nclassdef registers the first occurrence of a class
authorJean Privat <jean@pryen.org>
Thu, 12 Jun 2014 17:07:29 +0000 (13:07 -0400)
committerJean Privat <jean@pryen.org>
Thu, 12 Jun 2014 17:07:29 +0000 (13:07 -0400)
The first one is the good one.

Signed-off-by: Jean Privat <jean@pryen.org>

src/modelize_class.nit

index 87d28d1..5bc395b 100644 (file)
@@ -97,7 +97,9 @@ redef class ModelBuilder
                        error(nvisibility, "Error: refinement changed the visibility from a {mclass.visibility} to a {mvisibility}")
                end
                nclassdef.mclass = mclass
-               nmodule.mclass2nclassdef[mclass] = nclassdef
+               if not nmodule.mclass2nclassdef.has_key(mclass) then
+                       nmodule.mclass2nclassdef[mclass] = nclassdef
+               end
        end
 
        # Visit the AST and create the `MClassDef` objects