From 1f92d8858bfdd3f246967392a397d9693e7918ba Mon Sep 17 00:00:00 2001 From: Lucas Bajolet Date: Wed, 4 Jun 2014 16:01:25 -0400 Subject: [PATCH] debugger: Use a JSON-like notation for printing a variable's structure. Signed-off-by: Lucas Bajolet --- src/debugger.nit | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/debugger.nit b/src/debugger.nit index c1ca4fb..63c09b6 100644 --- a/src/debugger.nit +++ b/src/debugger.nit @@ -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 -- 1.7.9.5