debugger: Use a JSON-like notation for printing a variable's structure.
authorLucas Bajolet <r4pass@hotmail.com>
Wed, 4 Jun 2014 20:01:25 +0000 (16:01 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Wed, 4 Jun 2014 20:01:25 +0000 (16:01 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

src/debugger.nit

index c1ca4fb..63c09b6 100644 (file)
@@ -992,20 +992,18 @@ class Debugger
        # If it is a primitive type, its value is directly printed
        fun print_instance(instance: Instance)
        do
-               print "Printing innards of a variable"
-
                if instance isa MutableInstance then
-                       var attributes = instance.attributes
-                       print "Object : {instance}"
+                       print "\{"
+                       print "\ttype : {instance},"
 
-                       for current_attribute in attributes.keys do
-                               print "Attribute : {current_attribute.to_s} \nValeur : {attributes[current_attribute].to_s}"
-                       end
+                       printn("\t")
+
+                       print instance.attributes.join(",\n\t"," : ")
+
+                       print "\}"
                else
-                       print "Found variable {instance}"
+                       print "{instance}"
                end
-
-               print "Stopping printing innards of a variable"
        end
 
        # Prints the attributes demanded in a SequenceRead