metamodel: fast-fail in getters
[nit.git] / src / syntax / mmbuilder.nit
index 3a10b5a..db15e8b 100644 (file)
@@ -173,8 +173,9 @@ redef class MMSrcLocalClass
                                if not gp.is_init then continue
                                super_constructors.add(gp)
                        end
-                       var gp = sc.get_property_by_name(once ("init".to_symbol))
-                       if gp != null then
+                       var initname = once ("init".to_symbol)
+                       if sc.has_global_property_by_name(initname) then
+                               var gp = sc.get_property_by_name(initname)
                                super_inits.add(self[gp])
                        end
                end
@@ -1187,7 +1188,7 @@ redef class AClosureDecl
                        sig = new MMSignature(new Array[MMType], null, v.local_class.get_type)
                end
                if sig.return_type != null and n_kwbreak != null then
-                       v.error(self, "Syntax Error: A break bloc cannot have a return value.")
+                       v.error(self, "Syntax Error: A break block cannot have a return value.")
                end
 
                # Add the finalizer to the closure signature