ContextInspectorView.st
changeset 13809 55d97914d757
parent 13720 0c9ca76c6f23
child 13967 57e47c38703c
--- a/ContextInspectorView.st	Wed Feb 05 19:56:22 2014 +0100
+++ b/ContextInspectorView.st	Wed Feb 05 19:56:24 2014 +0100
@@ -73,7 +73,11 @@
     keepList := ((aContext == inspectedContext)
                 "/ care for contexts which change size
                 "/ (after the locals & stack-setup)
-                and:[ contextSize == inspectedContext size ]).
+                and:[ contextSize == inspectedContext size 
+                "/ care for JavaContexts whose set of visible variables
+                "/ may change during method execution ( nested block locals... )
+                and:[ aContext isJavaContext not 
+                ]]).
 
     keepList ifTrue:[
         "/ assume that the list remains unchanged;
@@ -125,10 +129,11 @@
 
             method notNil ifTrue:[
                 argsOnly ifFalse:[
-                    homeNames := method methodArgAndVarNames.
+                    homeNames := method methodArgAndVarNamesInContext: methodHomeContext.
 
                     "/ did it already allocate its locals ?
-                    (homeNames size > (methodHomeContext numArgs + methodHomeContext numVars)) ifTrue:[
+                    "/                 |-----------------------------| care about Java contexts where this is first arg
+                    (homeNames size > (methodHomeContext arg1Index - 1 + methodHomeContext numArgs + methodHomeContext numVars)) ifTrue:[
                         argsOnly := true.
                     ].
                 ].
@@ -197,7 +202,7 @@
             ].
 
             n := homeNames size.
-            n < ((argsOnly ifTrue:[0] ifFalse:[ methodHomeContext numVars]) + methodHomeContext numArgs) ifTrue:[
+            n < (((argsOnly or:[methodHomeContext isJavaContext]) ifTrue:[0] ifFalse:[ methodHomeContext numVars]) + methodHomeContext numArgs) ifTrue:[
                 "/ its a context which includes locals from
                 "/ inlined sub-blocks.
                 "/ First, generate synthetic varNames ...
@@ -293,6 +298,7 @@
     ].
 
     "Modified: / 03-06-2012 / 11:56:59 / cg"
+    "Modified: / 05-11-2013 / 15:44:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 namesOfBlockContext:aContext
@@ -613,25 +619,6 @@
     "Modified: / 16-05-2012 / 17:55:57 / cg"
 !
 
-valueAtLine:lineNr put:newValue
-    "helper - return the value of the selected entry"
-
-    |indexOfFirstNonSpecial contextIndex|
-
-    inspectedContext isNil ifTrue:[^ self].
-
-    "/ count the special lines
-    indexOfFirstNonSpecial := self fieldList findFirst:[:l | (l string startsWith:'-') not].
-    indexOfFirstNonSpecial == 0 ifTrue:[
-        ^ self
-    ].
-
-    contextIndex := lineNr - indexOfFirstNonSpecial + 1.
-
-    "yes, you can do that with a context"
-    inspectedContext at:contextIndex put:newValue.
-!
-
 valueForCommentLine:line
     "/ a hack to guide beginners
     (line startsWith:'>> no home') ifTrue:[
@@ -673,15 +660,34 @@
     self inspect:inspectedContext
 
     "Modified: 14.12.1995 / 19:24:49 / cg"
+!
+
+valueAtLine:lineNr put:newValue
+    "helper - return the value of the selected entry"
+
+    |indexOfFirstNonSpecial contextIndex|
+
+    inspectedContext isNil ifTrue:[^ self].
+
+    "/ count the special lines
+    indexOfFirstNonSpecial := self fieldList findFirst:[:l | (l string startsWith:'-') not].
+    indexOfFirstNonSpecial == 0 ifTrue:[
+        ^ self
+    ].
+
+    contextIndex := lineNr - indexOfFirstNonSpecial + 1.
+
+    "yes, you can do that with a context"
+    inspectedContext at:contextIndex put:newValue.
 ! !
 
 !ContextInspectorView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/ContextInspectorView.st,v 1.90 2013-12-07 15:02:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/ContextInspectorView.st,v 1.91 2014-02-05 18:56:24 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/ContextInspectorView.st,v 1.90 2013-12-07 15:02:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/ContextInspectorView.st,v 1.91 2014-02-05 18:56:24 cg Exp $'
 ! !