MiniInspector.st
changeset 23880 f366fd5a51b5
parent 23651 20175dbb7642
child 23882 4ff5dd3eda16
--- a/MiniInspector.st	Tue Mar 12 22:06:09 2019 +0100
+++ b/MiniInspector.st	Tue Mar 12 22:17:03 2019 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -89,11 +91,12 @@
 !
 
 commandLoop
-    |cmd valid lastValue|
+    |cmd valid lastValue idx|
 
     'MiniInspector on ' _errorPrint.  
     inspectedObject displayString _errorPrintCR.
     '' _errorPrintCR.
+    'Type "q" to quit, "?" for help ' _errorPrintCR.  
 
     [true] whileTrue:[
         valid := false.
@@ -154,7 +157,18 @@
             valid := true.
             self interpreterLoopWith:inspectedObject
         ].
-
+        (cmd == $N) ifTrue:[
+            (commandArg withoutSeparators conform:#isDigit) ifTrue:[
+                (idx := Integer readFrom:commandArg) > 0 ifTrue:[
+                    (idx <= inspectedObject class instSize) ifFalse:[
+                        'bad instvar index' _errorPrintCR
+                    ] ifTrue:[  
+                        inspectedObject instVarAt:idx put:nil.
+                        valid := true.
+                    ].    
+                ].    
+            ].
+        ].    
         (cmd == $q) ifTrue:[
             ^ cmd.
         ].
@@ -173,7 +187,8 @@
  $        inspect the value of the last evaluated expression
 
  C ...... inspect class
- <Num> .. inspect instvar num (1..)
+ <N> .... inspect instvar <N> (N=1..)
+ N <N> .. nil instvar <N> (N=1..) 
 
  * ...... becomeNil and quit (dangerous)
  q ...... quit
@@ -182,7 +197,7 @@
     ].
 
     "Modified: / 03-02-2014 / 10:19:46 / cg"
-    "Modified: / 29-01-2019 / 14:14:21 / Claus Gittinger"
+    "Modified: / 12-03-2019 / 22:16:45 / Claus Gittinger"
 !
 
 enter