grammar: new production `array_items` to replace arg_list for literal arrays
[nit.git] / src / interpreter / debugger.nit
index 8723ed7..58a49d1 100644 (file)
@@ -65,7 +65,7 @@ end
 
 redef class ScopeVisitor
 
-       redef init(toolcontext)
+       redef init
        do
                super
                if toolcontext.dbg != null then
@@ -103,7 +103,7 @@ redef class ToolContext
        redef fun check_errors
        do
                if dbg == null then
-                       super
+                       return super
                else
                        if messages.length > 0 then
                                message_sorter.sort(messages)
@@ -116,6 +116,7 @@ redef class ToolContext
 
                        messages.clear
                end
+               return not had_error
        end
 
        # -d
@@ -279,20 +280,13 @@ class Debugger
                assert args.length == mpropdef.msignature.arity + 1 else debug("Invalid arity for {mpropdef}. {args.length} arguments given.")
 
                # Look for the AST node that implements the property
-               var mproperty = mpropdef.mproperty
-               if self.modelbuilder.mpropdef2npropdef.has_key(mpropdef) then
-                       var npropdef = self.modelbuilder.mpropdef2npropdef[mpropdef]
-                       self.parameter_check(npropdef, mpropdef, args)
-                       if npropdef isa AMethPropdef then
-                               return npropdef.rt_call(self, mpropdef, args)
-                       else
-                               print "Error, invalid propdef to call at runtime !"
-                               return null
-                       end
-               else if mproperty.is_root_init then
-                       var nclassdef = self.modelbuilder.mclassdef2nclassdef[mpropdef.mclassdef]
-                       self.parameter_check(nclassdef, mpropdef, args)
-                       return nclassdef.call(self, mpropdef, args)
+               var node = modelbuilder.mpropdef2node(mpropdef)
+               if node isa AMethPropdef then
+                       self.parameter_check(node, mpropdef, args)
+                       return node.rt_call(self, mpropdef, args)
+               else if node isa AClassdef then
+                       self.parameter_check(node, mpropdef, args)
+                       return node.call(self, mpropdef, args)
                else
                        fatal("Fatal Error: method {mpropdef} not found in the AST")
                        abort
@@ -1442,16 +1436,11 @@ end
 private class TraceObject
 
        # Map of the local names bound to a frame
-       var trace_map: HashMap[Frame, String]
+       var trace_map = new HashMap[Frame, String]
+
        # Decides if breaking or printing statement when the variable is encountered
        var break_on_encounter: Bool
 
-       init(break_on_encounter: Bool)
-       do
-               trace_map = new HashMap[Frame, String]
-               self.break_on_encounter = break_on_encounter
-       end
-
        # Adds the local alias for a variable and the frame bound to it
        fun add_frame_variable(frame: Frame, variable_name: String)
        do