Allow single underscore as method / block argument and temporaries
This commit is a follow up for 38b221e.
"{ Package: 'stx:libcomp' }"!
!Block methodsFor:'accessing'!
dbgVariableTable
"Return a DIVariableTable for this method"
^ self homeMethod dbgVariableTable
"Created: / 07-02-2019 / 08:41:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Block methodsFor:'accessing'!
dbgVariables
"Return a list of variables for this context (as collection
of `DIVariable` instances) or nil if no debug info is recorded"
| vartab |
vartab := self dbgVariableTable.
^ vartab notNil ifTrue:[ vartab variables select:[:e | e physicalBlockSourceOffset == sourcePos ] ] ifFalse:[ nil ]
"Created: / 07-02-2019 / 08:46:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 27-05-2020 / 15:21:57 / Jan Vrany <jan.vrany@labware.com>"
! !
!Context methodsFor:'special accessing'!
argAndVarNames
"helper: given a context, return a collection of arg&var names"
"/
"/ Note that this method overrides the default implementation
"/ from stx:libbasic.
"/ The default is horrible, complex and buggy, never worked properly.
"/ And will be removed later without notice
|varinfos varnames |
varinfos := self dbgVariables.
varnames := Array new: self numArgs + self numVars.
varinfos size ~~ varnames size ifTrue:[
"/ Not all variables recorded, generate synthetic ones
self breakPoint: #jv.
1 to: self numArgs do:[:i |
varnames at: i put: ('arg', i printString)
].
self numArgs + 1 to: varnames size do:[:i |
varnames at: i put: ('local', (i - self numArgs) printString)
]
].
varinfos do:[:varinfo |
varnames at: varinfo frameOffset put: varinfo name
].
^ varnames.
"Modified: / 26-12-2015 / 08:20:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 27-05-2020 / 15:40:39 / Jan Vrany <jan.vrany@labware.com>"
! !
!Context methodsFor:'accessing'!
dbgVariableTable
"Return a DIVariableTable for this method"
^ method dbgVariableTable
"Created: / 07-02-2019 / 08:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Context methodsFor:'accessing'!
dbgVariables
"Return a list of variables for this context (as collection
of `DIVariable` instances) or nil if no debug info is recorded"
^ method notNil ifTrue:[ method dbgVariables ] ifFalse:[ #() ]
"Created: / 07-02-2019 / 08:45:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 29-06-2020 / 22:26:33 / Jan Vrany <jan.vrany@labware.com>"
! !
!Method methodsFor:'accessing'!
dbgInfo
"Returns debug info for this method or `nil` if not debug info
available."
| l |
l := self at: 1.
^ l isByteArray ifTrue:[ DIInfo decode: l readStream ] ifFalse:[ nil ].
"
(Smalltalk class >> #loadPackage:asAutoloaded:) dbgInfo
"
"Created: / 10-07-2018 / 13:11:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (comment): / 15-07-2018 / 17:10:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Method methodsFor:'accessing'!
dbgVariableTable
"Return a DIVariableTable for this method or nil if not debug info is recorded"
| info |
info := self dbgInfo.
^ info notNil ifTrue:[ info dbgVariableTable ] ifFalse:[ nil ]
"Created: / 15-07-2018 / 11:52:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (comment): / 07-02-2019 / 08:41:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 27-05-2020 / 15:19:45 / Jan Vrany <jan.vrany@labware.com>"
! !
!Method methodsFor:'accessing'!
dbgVariables
"Return a list of variables for this context (as collection
of `DIVariable` instances) or nil if no debug info is recorded"
| vartab |
vartab := self dbgVariableTable.
^ vartab notNil ifTrue:[ vartab variables select:[:e | e physicalBlockSourceOffset == 0 ] ] ifFalse:[ nil ]
"Created: / 07-02-2019 / 08:47:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 27-05-2020 / 15:21:14 / Jan Vrany <jan.vrany@labware.com>"
! !
!Object methodsFor:'user interaction & notifications'!
notifyTodo:msg position:position
className:className selector:selector
severity:severityOrSeveritySymbol priority:priorityOrPrioritySymbol
equalityParameter:equalityParameter checkAction:checkAction
"this is a message from the compiler system, to allow for a hook to remember
things to do. Can aslo used by other subsystems to add entries to the toDoList"
(Tools::CompilerWarningToDoListEntry notNil
and:[Tools::CompilerWarningToDoListEntry isLoaded]) ifFalse:[^ self ].
Tools::CompilerWarningToDoListEntry
notifyTodo:msg position:position
className:className selector:selector
severity:severityOrSeveritySymbol priority:priorityOrPrioritySymbol
equalityParameter:equalityParameter checkAction:checkAction
"Modified: / 15-03-2007 / 20:29:23 / cg"
! !
!stx_libcomp class methodsFor:'documentation'!
extensionsVersion_HG
^ '$Changeset: <not expanded> $'
! !