diff -r 92bcaa9996ae -r b480a51cfb5f ContextInspectorView.st --- a/ContextInspectorView.st Thu Dec 14 21:21:30 1995 +0100 +++ b/ContextInspectorView.st Thu Dec 14 21:22:39 1995 +0100 @@ -11,10 +11,10 @@ " InspectorView subclass:#ContextInspectorView - instanceVariableNames:'inspectedContext values names showingTemporaries' - classVariableNames:'' - poolDictionaries:'' - category:'Interface-Inspector' + instanceVariableNames:'inspectedContext names showingTemporaries argsOnly' + classVariableNames:'' + poolDictionaries:'' + category:'Interface-Inspector' ! !ContextInspectorView class methodsFor:'documentation'! @@ -47,16 +47,21 @@ |homeContext method homeNames rec sel implementorClass argNames varNames tmpNames m argsOnly| - hasMore := false. + (con == inspectedContext) ifTrue:[ + listView selection notNil ifTrue:[ + self showSelection:(listView selection). + ]. + ^ self + ]. + + hasMore := argsOnly := false. inspectedObject := nil. inspectedContext := con. - argsOnly := false. con isNil ifTrue:[ - names := nil. - values := nil. - listView list:nil. - ^ self + names := nil. + listView list:nil. + ^ self ]. "/ realized ifFalse:[^ self]. @@ -64,61 +69,61 @@ homeContext := con methodHome. homeContext isNil ifTrue:[ - "its a cheap blocks context" - rec := con receiver. - sel := con selector. - homeNames := OrderedCollection new. + "its a cheap blocks context" + rec := con receiver. + sel := con selector. + homeNames := OrderedCollection new. ] ifFalse:[ - rec := homeContext receiver. - sel := homeContext selector. + rec := homeContext receiver. + sel := homeContext selector. - implementorClass := homeContext methodClass. - implementorClass notNil ifTrue:[ - method := implementorClass compiledMethodAt:sel. - method notNil ifTrue:[ - method isWrapped ifTrue:[ - " - in a wrapped context, locals are something different - " + implementorClass := homeContext methodClass. + implementorClass notNil ifTrue:[ + method := implementorClass compiledMethodAt:sel. + method notNil ifTrue:[ + method isWrapped ifTrue:[ + " + in a wrapped context, locals are something different + " "/ argsOnly := true. - m := method originalMethod. - m notNil ifTrue:[ - method := m. - ] ifFalse:[ - argsOnly := true. - ]. - ]. - ]. - method notNil ifTrue:[ - method source notNil ifTrue:[ - argsOnly ifTrue:[ - homeNames := method methodArgNames - ] ifFalse:[ - homeNames := method methodArgAndVarNames. - ] - ] - ]. - ]. + m := method originalMethod. + m notNil ifTrue:[ + method := m. + ] ifFalse:[ + argsOnly := true. + ]. + ]. + ]. + method notNil ifTrue:[ + method source notNil ifTrue:[ + argsOnly ifTrue:[ + homeNames := method methodArgNames + ] ifFalse:[ + homeNames := method methodArgAndVarNames. + ] + ] + ]. + ]. - " - create dummy names for method vars (if there is no source available) - " - homeNames isNil ifTrue:[ - homeNames := OrderedCollection new. - 1 to:homeContext numArgs do:[:index | - homeNames add:('mArg' , index printString) - ]. - argsOnly ifFalse:[ - 1 to:homeContext nvars do:[:index | - homeNames add:('mVar' , index printString) - ]. - showingTemporaries ifTrue:[ - 1 to:homeContext ntemp do:[:index | - homeNames add:('mTmp' , index printString) - ] - ] - ] - ]. + " + create dummy names for method vars (if there is no source available) + " + homeNames isNil ifTrue:[ + homeNames := OrderedCollection new. + 1 to:homeContext numArgs do:[:index | + homeNames add:('mArg' , index printString) + ]. + argsOnly ifFalse:[ + 1 to:homeContext nvars do:[:index | + homeNames add:('mVar' , index printString) + ]. + showingTemporaries ifTrue:[ + 1 to:homeContext ntemp do:[:index | + homeNames add:('mTmp' , index printString) + ] + ] + ] + ]. ]. " @@ -126,55 +131,40 @@ method-home and put real names in here " con isBlockContext ifTrue:[ - names := OrderedCollection new. - - argNames := (1 to:(con numArgs)) collect:[:i | 'arg' , i printString]. - names addAll:argNames. - varNames := (1 to:(con nvars)) collect:[:i | 'var' , i printString]. - names addAll:varNames. + names := OrderedCollection new. - showingTemporaries ifTrue:[ - tmpNames := (1 to:(con ntemp)) collect:[:i | 'tmp' , i printString]. - names addAll:tmpNames. - ]. - - names addAll:homeNames. + argNames := (1 to:(con numArgs)) collect:[:i | 'arg' , i printString]. + names addAll:argNames. + varNames := (1 to:(con nvars)) collect:[:i | 'var' , i printString]. + names addAll:varNames. - values := Array withAll:(con argsAndVars). - (showingTemporaries and:[con ntemp ~~ 0]) ifTrue:[ - values := values , con temporaries - ]. - homeContext notNil ifTrue:[ - values := values , homeContext args. - argsOnly ifFalse:[ - values := values , homeContext vars. - (showingTemporaries and:[homeContext ntemp ~~ 0])ifTrue:[ - values := values , homeContext temporaries - ] - ]. - ]. + showingTemporaries ifTrue:[ + tmpNames := (1 to:(con ntemp)) collect:[:i | 'tmp' , i printString]. + names addAll:tmpNames. + ]. + names addAll:homeNames. ] ifFalse:[ - names := homeNames. - argsOnly ifTrue:[ - values := homeContext args - ] ifFalse:[ - values := homeContext argsAndVars - ] + names := homeNames. ]. listView list:names. workspace contents:nil. self setDoitActionIn:workspace for:con. + + "Modified: 14.12.1995 / 19:34:35 / cg" ! release "release inspected object" +'released' printNL. inspectedContext := nil. - names := values := nil. + names := nil. super release + + "Modified: 14.12.1995 / 19:34:39 / cg" ! ! !ContextInspectorView methodsFor:'initialization'! @@ -227,6 +217,12 @@ ^ names ! +hasSelfEntry + ^ false + + "Created: 14.12.1995 / 19:29:47 / cg" +! + setDoitActionIn:aWorkspace for:aContext aWorkspace doItAction:[:theCode | Compiler evaluate:theCode @@ -241,9 +237,40 @@ valueAtLine:lineNr "helper - return the value of the selected entry" + |homeContext con values| + + inspectedContext isNil ifTrue:[^ nil]. + + argsOnly := false. + con := inspectedContext. + homeContext := con methodHome. + + con isBlockContext ifTrue:[ + values := Array withAll:(con argsAndVars). + (showingTemporaries and:[con ntemp ~~ 0]) ifTrue:[ + values := values , con temporaries + ]. + homeContext notNil ifTrue:[ + values := values , homeContext args. + argsOnly ifFalse:[ + values := values , homeContext vars. + (showingTemporaries and:[homeContext ntemp ~~ 0])ifTrue:[ + values := values , homeContext temporaries + ] + ]. + ]. + ] ifFalse:[ + argsOnly ifTrue:[ + values := homeContext args + ] ifFalse:[ + values := homeContext argsAndVars + ] + ]. + +values printNL. ^ values at:lineNr. - + "Modified: 14.12.1995 / 19:28:10 / cg" ! ! !ContextInspectorView methodsFor:'user actions'! @@ -262,24 +289,25 @@ ! hideTemporaries + "do not show contexts temporaries" + showingTemporaries := false. self inspect:inspectedContext -! -showSelection:lineNr - "user clicked on an entry - show value in workspace" - - self showValue:(values at:lineNr). - selectedLine := lineNr + "Modified: 14.12.1995 / 19:24:44 / cg" ! showTemporaries + "show contexts temporaries" + showingTemporaries := true. self inspect:inspectedContext + + "Modified: 14.12.1995 / 19:24:49 / cg" ! ! !ContextInspectorView class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/ContextInspectorView.st,v 1.18 1995-11-23 17:44:21 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/ContextInspectorView.st,v 1.19 1995-12-14 20:22:39 cg Exp $' ! !