nitdbg: Added function to modify the state of a variable in the current frame
authorLucas BAJOLET <r4pass@r4pass-ubu-laptophp.(none)>
Fri, 22 Feb 2013 19:54:17 +0000 (14:54 -0500)
committerLucas Bajolet <r4pass@hotmail.com>
Tue, 19 Mar 2013 18:05:03 +0000 (14:05 -0400)
Signed-off-by: Lucas BAJOLET <r4pass@hotmail.com>

src/debugger.nit

index 1d9e344..eeba024 100644 (file)
@@ -719,6 +719,27 @@ class Debugger
        end
 
        #######################################################################
+       ##                  Runtime modification functions                   ##
+       #######################################################################
+
+       # Modifies the value of a variable contained in a frame
+       fun modify_in_frame(variable: Instance, value: String)
+       do
+               var new_variable = get_variable_of_type_with_value(variable.mtype.to_s, value)
+               if new_variable != null
+               then
+                       var keys = frame.map.keys
+                       for key in keys
+                       do
+                               if frame.map[key] == variable
+                               then
+                                       frame.map[key] = new_variable
+                               end
+                       end
+               end
+       end
+
+       #######################################################################
        ##                   Variable generator functions                    ##
        #######################################################################