The Inbox: Tools-ct.1018.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Tools-ct.1018.mcz

commits-2
A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-ct.1018.mcz

==================== Summary ====================

Name: Tools-ct.1018
Author: ct
Time: 13 November 2020, 7:33:52.268415 pm
UUID: ea70ff0a-7e69-f14c-9c66-96e41960f600
Ancestors: Tools-mt.1015

Complements Kernel-ct.1365 (BlockClosure >> #generateExpressionWithArguments:). Now also handles symbols as valueGetters correctly.

=============== Diff against Tools-mt.1015 ===============

Item was removed:
- ----- Method: InspectorField class>>generateExpressionFrom:argumentNames: (in category 'support') -----
- generateExpressionFrom: aBlock argumentNames: argumentNames
-
- | blockNode arguments variables context receiver |
- self flag: #experimental.
- blockNode := aBlock decompile veryDeepCopy. "some literals are singletons, see #becomeForward: below"
- arguments := blockNode arguments collect: #name.
- variables := Dictionary new.
- variables
- at: #true put: true;
- at: #false put: false;
- at: #nil put: nil.
- receiver := aBlock receiver.
- receiver class allInstVarNames
- withIndexDo: [:name :index |
- variables at: name put: (receiver instVarAt: index)].
- context := aBlock outerContext.
- context tempNames
- withIndexDo: [:name :index |
- variables at: name put: (context namedTempAt: index)].
- blockNode nodesDo: [:node |
- self flag: #ct. "Should we introduce #nodesCollect: instead of using dangerous #becomeForward:?"
- {
- [node isVariableNode not].
- [| argumentIndex |
- argumentIndex := arguments indexOf: node name.
- argumentIndex isZero
- ifFalse: [node name: (argumentNames at: argumentIndex)];
- not].
- [variables at: node name
- ifPresent: [:value |
- value isLiteral
- ifTrue: [node becomeForward: (LiteralNode new key: value)];
- yourself]
- ifAbsent: [^ nil]].
- } detect: #value ifNone: [^ nil]].
- ^ String streamContents: [:stream |
- blockNode
- printStatementsOn: stream
- indent: 0].!

Item was changed:
  ----- Method: InspectorField>>expressionWithReceiverName: (in category 'accessing - code') -----
  expressionWithReceiverName: receiverName
  "The code string to run for getting the receiver's value. The receiver's name, which is usually #self, can be replaced to fit specific debugging scenarios such as ThisContext."
 
  ^ valueGetterExpression ifNil: [
+ | getter |
+ getter := self valueGetter.
+ getter isCompiledCode
- self valueGetter isCompiledCode
  ifTrue: [ "precompiled user code"
+ getter getSource ]
- self valueGetter getSource ]
  ifFalse: [ "evaluable"
+ getter isBlock
+ ifTrue: [
+ [getter generateExpressionWithArguments: {receiverName}]
+ ifError: [nil]]
+ ifFalse: [
+ self assert: getter numArgs isZero.
+ 'self ' , getter ] ] ]!
- self class
- generateExpressionFrom: self valueGetter
- argumentNames: {receiverName} ] ]!