Fix `Context >> argAndVarNames` in cases when debug info is not available jv
authorJan Vrany <jan.vrany@labware.com>
Mon, 15 Jun 2020 11:33:35 +0100
branchjv
changeset 25392 c52eeea62763
parent 25391 cad52f81f60c
child 25393 60d04a0b08f6
Fix `Context >> argAndVarNames` in cases when debug info is not available
Context.st
--- a/Context.st	Mon Jun 22 23:57:33 2020 +0100
+++ b/Context.st	Mon Jun 15 11:33:35 2020 +0100
@@ -2,6 +2,7 @@
  COPYRIGHT (c) 1988 by Claus Gittinger
  COPYRIGHT (c) 2009-2011 Jan Vrany
  COPYRIGHT (c) 2015-2017 Jan Vrany
+ COPYRIGHT (c) 2020 LabWare
 	      All Rights Reserved
 
  This software is furnished under a license and may be used
@@ -30,6 +31,7 @@
  COPYRIGHT (c) 1988 by Claus Gittinger
  COPYRIGHT (c) 2009-2011 Jan Vrany
  COPYRIGHT (c) 2015-2017 Jan Vrany
+ COPYRIGHT (c) 2020 LabWare
 	      All Rights Reserved
 
  This software is furnished under a license and may be used
@@ -2547,124 +2549,6 @@
 
 !Context methodsFor:'special accessing'!
 
-argAndVarNames
-    "helper: given a context, return a collection of arg&var names"
-
-    |homeContext homeMethod block numArgs numVars m src
-     sel isDoIt blocksLineNr extractFromBlock sender|
-
-    numArgs := self argumentCount.
-    numVars := self numVars.
-    (numArgs == 0 and:[numVars == 0]) ifTrue:[^ #()].
-
-    homeContext := self methodHome.
-    homeContext notNil ifTrue:[
-        sel := homeContext selector.
-        homeMethod := homeContext method.
-    ].
-
-    extractFromBlock :=
-        [
-            |blockNode argNames varNames vars args blocksHome|
-
-            blockNode := Compiler
-                            blockAtLine:blocksLineNr
-                            in:m
-                            orSource:src
-                            numArgs:numArgs
-                            numVars:numVars.
-
-            blockNode notNil ifTrue:[
-                "/ a kludge
-                blockNode lineNumber == blocksLineNr ifTrue:[
-                    blocksHome := blockNode home.
-                    (blocksHome notNil and:[blocksHome isBlock]) ifTrue:[
-                        (blocksHome numArgs == numArgs
-                        and:[ blocksHome numVars == numVars ]) ifTrue:[
-                            blockNode := blocksHome
-                        ].
-                    ].
-                ].
-
-                argNames := #().
-                varNames := #().
-
-                numArgs > 0 ifTrue:[
-                    vars := blockNode arguments.
-                    vars notEmptyOrNil ifTrue:[
-                        argNames := vars collect:[:var | var name]
-                    ]
-                ].
-                numVars > 0 ifTrue:[
-                    vars := blockNode variablesIncludingInlined: (homeMethod hasCode and:[homeMethod isDynamic not]).
-                    vars notEmptyOrNil ifTrue:[
-                        varNames := vars collect:[:var | var name].
-                    ]
-                ].
-                ^ argNames , varNames
-            ].
-        ].
-
-    "/ #doIt needs special handling below
-    isDoIt := (sel == #'doIt') or:[sel == #'doIt:'].
-    self isBlockContext ifFalse:[
-        isDoIt ifTrue:[
-            homeMethod notNil ifTrue:[
-                "/ special for #doIt
-                m := nil.
-                src := ('[' , homeMethod source , '\]') withCRs.
-                "/ blocksLineNr := self lineNumber.
-                blocksLineNr := (self home ? self) lineNumber.
-                extractFromBlock value.
-            ]
-        ].
-
-        homeMethod notNil ifTrue:[
-            ^ homeMethod methodArgAndVarNamesInContext: self.
-        ].
-        ^ #()
-    ].
-
-    homeMethod notNil ifTrue:[
-        isDoIt ifTrue:[
-            "/ special for #doIt
-            "/ my source is found in the method.
-            m := nil.
-            src := ('[' , homeMethod source , '\]') withCRs.
-        ] ifFalse:[
-            m := homeMethod.
-            src := nil.
-        ].
-        blocksLineNr := self lineNumber.
-        extractFromBlock value.
-        blocksLineNr := self home lineNumber.
-        extractFromBlock value.
-    ].
-
-    blocksLineNr isNil ifTrue:[
-        self isBlockContext ifTrue:[
-            sender := self sender.
-            (sender notNil
-            and:[sender receiver isBlock
-            and:[sender selector startsWith:'value']])
-            ifTrue:[
-                block := sender receiver.
-                src := block source.
-                src isNil ifTrue:[
-                    self error:'no source'.
-                ].
-                blocksLineNr := 1.
-                extractFromBlock value.
-            ].
-            sender := nil.
-        ].
-    ].
-
-    ^ #()
-
-    "Modified: / 26-12-2015 / 08:20:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 canResume
     "return true, if the receiver allows to be resumed.
      In ST/X, due to the implementation, this requires that the context which