Christoph Thiede uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-ct.469.mcz
==================== Summary ====================
Name: Compiler-ct.469
Author: ct
Time: 7 February 2022, 10:19:35.139791 pm
UUID: 82deaae4-e9ba-7341-aef8-8272397ba297
Ancestors: Compiler-ct.468, Compiler.ShadowedVariableNotification-ct.468
Merges and documents Compiler.ShadowedVariableNotification-ct.468.
=============== Diff against Compiler-ct.468 ===============
Item was changed:
----- Method: Encoder>>warnAboutShadowed: (in category 'private') -----
warnAboutShadowed: name
+
requestor addWarning: name,' is shadowed'.
+ selector ifNil: [^ self].
+ (ShadowedVariableNotification new
+ name: name
+ selector: selector
+ class: cue getClass) signal.!
- selector ifNotNil:
- [Transcript cr; show: cue getClass name,'>>', selector, '(', name,' is shadowed)']!
Item was added:
+ Notification subclass: #ShadowedVariableNotification
+ instanceVariableNames: 'name selector class'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Compiler-Support'!
+
+ !ShadowedVariableNotification commentStamp: 'ct 2/7/2022 22:18' prior: 0!
+ I tell interested exception handlers or the Transcript about an attempt to compile a method with a shadowed variable, i.e., a temporary variable that has the same name as an existing instance variable in the subject class. The use and usage of shadowed variables are generally disputed: They can lead to confusion when a temporary variable declaration is missed, but they can also be utilized to make an instance variable unaccessible in a local scope.!
Item was added:
+ ----- Method: ShadowedVariableNotification>>defaultAction (in category 'handling') -----
+ defaultAction
+
+ Transcript showln: ('{1} ({2} is shadowed)' translated format:
+ {self methodClass name , '>>' , self selector.
+ self variableName}).!
Item was added:
+ ----- Method: ShadowedVariableNotification>>methodClass (in category 'accessing') -----
+ methodClass
+
+ ^ class!
Item was added:
+ ----- Method: ShadowedVariableNotification>>name:selector:class: (in category 'initialize-release') -----
+ name: aString selector: aSymbolOrNil class: aBehavior
+
+ name := aString.
+ selector := aSymbolOrNil.
+ class := aBehavior.!
Item was added:
+ ----- Method: ShadowedVariableNotification>>selector (in category 'accessing') -----
+ selector
+
+ ^ selector!
Item was added:
+ ----- Method: ShadowedVariableNotification>>variableName (in category 'accessing') -----
+ variableName
+
+ ^ name!
Christoph Thiede uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-ct.468.mcz
==================== Summary ====================
Name: Compiler-ct.468
Author: ct
Time: 7 February 2022, 9:15:41.34029 pm
UUID: 97a5d3e3-3885-474c-b539-57e0a2310dbb
Ancestors: Compiler-mt.467
Makes UndeclaredVariableWarning a notification and renames it into UndeclaredVariableNotification. UndeclaredVariableWarning is still available via 60Deprecated.
Note that in a later revision, we could also unify this exception with UndeclaredVariable, which is a subclass of ParserNotification.
See: http://lists.squeakfoundation.org/pipermail/squeak-dev/2022-January/218508.…
=============== Diff against Compiler-mt.467 ===============
Item was changed:
----- Method: Encoder>>undeclared: (in category 'encoding') -----
undeclared: name
| sym |
(requestor notNil and: [requestor interactive]) ifTrue:
[ requestor requestor == #error: ifTrue: [ requestor error: 'Undeclared' ].
^ self notify: 'Undeclared' ].
"Allow knowlegeable clients to squash the undeclared warning if they want (e.g.
Diffing pretty printers that are simply formatting text). As this breaks
compilation it should only be used by clients that want to discard the result
of the compilation. To squash the warning use e.g.
[Compiler format: code in: class notifying: nil decorated: false]
+ on: UndeclaredVariableNotification
- on: UndeclaredVariableWarning
do: [:ex| ex resume: false]"
sym := name asSymbol.
+ ^ (UndeclaredVariableNotification new
- ^ (UndeclaredVariableWarning new
name: name
selector: selector
class: cue getClass) signal
ifTrue:
[ | undeclared |
undeclared := cue environment undeclared.
[ undeclared
at: sym
put: nil ]
on: AttemptToWriteReadOnlyGlobal
do: [ : noti | noti resume: true ].
self
global: (undeclared associationAt: sym)
name: sym ]
ifFalse:
[ self
global: (Association key: sym)
name: sym ]!
Item was added:
+ Notification subclass: #UndeclaredVariableNotification
+ instanceVariableNames: 'name selector class'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Compiler-Support'!
Item was added:
+ ----- Method: UndeclaredVariableNotification>>defaultAction (in category 'exceptionDescription') -----
+ defaultAction
+ "The user should be notified of the occurrence of an exceptional occurrence and
+ given an option of continuing or aborting the computation. The description of the
+ occurrence should include any text specified as the argument of the #signal: message."
+
+ selector ifNotNil: [Transcript cr; nextPutAll: class name, '>>', selector, ' ']
+ ifNil: [Transcript cr ].
+ Transcript show: '(' , name , ' is Undeclared) '.
+ ^true!
Item was added:
+ ----- Method: UndeclaredVariableNotification>>defaultResumeValue (in category 'initialize-release') -----
+ defaultResumeValue
+ "Answer the value that by default should be returned if the exception is resumed"
+ ^true!
Item was added:
+ ----- Method: UndeclaredVariableNotification>>name:selector:class: (in category 'initialize-release') -----
+ name: aString selector: aSymbolOrNil class: aBehavior
+ name := aString.
+ selector := aSymbolOrNil.
+ class := aBehavior!
Item was removed:
- Warning subclass: #UndeclaredVariableWarning
- instanceVariableNames: 'name selector class'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Compiler-Support'!
Item was removed:
- ----- Method: UndeclaredVariableWarning>>defaultAction (in category 'exceptionDescription') -----
- defaultAction
- "The user should be notified of the occurrence of an exceptional occurrence and
- given an option of continuing or aborting the computation. The description of the
- occurrence should include any text specified as the argument of the #signal: message."
-
- selector ifNotNil: [Transcript cr; nextPutAll: class name, '>>', selector, ' ']
- ifNil: [Transcript cr ].
- Transcript show: '(' , name , ' is Undeclared) '.
- ^true!
Item was removed:
- ----- Method: UndeclaredVariableWarning>>defaultResumeValue (in category 'initialize-release') -----
- defaultResumeValue
- "Answer the value that by default should be returned if the exception is resumed"
- ^true!
Item was removed:
- ----- Method: UndeclaredVariableWarning>>name:selector:class: (in category 'initialize-release') -----
- name: aString selector: aSymbolOrNil class: aBehavior
- name := aString.
- selector := aSymbolOrNil.
- class := aBehavior!
Marcel Taeumel uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-mt.462.mcz
==================== Summary ====================
Name: EToys-mt.462
Author: mt
Time: 7 February 2022, 11:09:11.238414 am
UUID: c978b75e-a2d0-294a-81de-782f4a95d122
Ancestors: EToys-mt.461
Complements Morphic-mt.1874
=============== Diff against EToys-mt.461 ===============
Item was removed:
- ----- Method: TextMorph>>selectionColor (in category '*Etoys-Squeakland-private') -----
- selectionColor
-
- | ind attrs c |
- ind := self editor startBlock stringIndex.
- (ind isNil or: [ind < 1 or: [ind > text size]]) ifTrue: [ind := 1].
- attrs := text attributesAt: ind.
- c := attrs detect: [:attr | attr class = TextColor] ifNone: [].
- ^ c ifNil: [Color black] ifNotNil: [c color].
-
- !
Item was removed:
- ----- Method: TextMorph>>selectionColor: (in category '*Etoys-Squeakland-private') -----
- selectionColor: aColor
- "Set the color of the current selection. If there is currently no selection, have the color apply to the entirety of the receiver's text."
-
- | attribute int |
- attribute := TextColor color: aColor.
- int := self editor selectionInterval.
- int size <= 0 ifTrue: [int := 1 to: text size].
- text addAttribute: attribute from: int first to: int last.
- int size = text string size ifTrue:
- [color := aColor].
- self changed.
- !
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1444.mcz
==================== Summary ====================
Name: Kernel-eem.1444
Author: eem
Time: 6 February 2022, 1:06:19.372648 pm
UUID: fcc28469-65a2-463c-aafe-34de0816a2c2
Ancestors: Kernel-mt.1443
Fi Context>>send:to:with:lookupIn:. The contract for object-as-method is not that the VM expects instances of CompiledBlock and CompiledMethod, but any general instance of CompiledCode. So implement isCompiledCodeClass and use this on the class of the method.
Tiny speedup/simplification for MessageSend class>>#receiver:selector:argument:
=============== Diff against Kernel-mt.1443 ===============
Item was added:
+ ----- Method: CompiledCode class>>isCompiledCodeClass (in category 'testing') -----
+ isCompiledCodeClass
+ ^true!
Item was changed:
----- Method: Context>>send:to:with:lookupIn: (in category 'controlling') -----
send: selector to: rcvr with: arguments lookupIn: lookupClass
"Simulate the action of sending a message with selector and arguments to rcvr. The argument, lookupClass, is the class in which to lookup the message. This is the receiver's class for normal messages, but for super messages it will be some specific class related to the source method."
+ | meth primIndex val ctxt |
- | meth methClass primIndex val ctxt |
(meth := lookupClass lookupSelector: selector) ifNil:
[selector == #doesNotUnderstand: ifTrue:
[self error: 'Recursive message not understood!!' translated].
^self send: #doesNotUnderstand:
to: rcvr
with: {(Message selector: selector arguments: arguments) lookupClass: lookupClass}
lookupIn: lookupClass].
+ (self objectClass: meth) isCompiledCodeClass ifFalse:
- ((methClass := self objectClass: meth) == CompiledMethod or: [methClass == CompiledBlock]) ifFalse:
["Object as Methods (OaM) protocol: 'The contract is that, when the VM encounters an ordinary object (rather than a compiled method) in the method dictionary during lookup, it sends it the special selector #run:with:in: providing the original selector, arguments, and receiver.'. DOI: 10.1145/2991041.2991062."
^self send: #run:with:in:
to: meth
with: {selector. arguments. rcvr}].
meth numArgs = arguments size ifFalse:
[^ self error: ('Wrong number of arguments in simulated message {1}' translated format: {selector})].
(primIndex := meth primitive) > 0 ifTrue:
[val := self doPrimitive: primIndex method: meth receiver: rcvr args: arguments.
(self isPrimFailToken: val) ifFalse:
[^val]].
ctxt := self activateMethod: meth withArgs: arguments receiver: rcvr.
(primIndex isInteger and: [primIndex > 0]) ifTrue:
[ctxt failPrimitiveWith: val].
^ctxt!
Item was changed:
----- Method: MessageSend class>>receiver:selector:argument: (in category 'instance creation') -----
receiver: anObject selector: aSymbol argument: aParameter
+ ^self receiver: anObject selector: aSymbol arguments: { aParameter }!
- ^ self receiver: anObject selector: aSymbol arguments: (Array with: aParameter)!
Item was added:
+ ----- Method: Object>>isCompiledCodeClass (in category 'testing') -----
+ isCompiledCodeClass
+ ^false!
Christoph Thiede uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-ct.1126.mcz
==================== Summary ====================
Name: Tools-ct.1126
Author: ct
Time: 6 February 2022, 9:24:10.500919 pm
UUID: 95ff44c7-b6bf-0e46-b8e4-4d261c4c3806
Ancestors: Tools-mt.1125
Fixes a bug when switching to an explorer from an inspector that has unaccepted contents in the value pane. Rather than replacing the value of a field (or even replacing the inspected/explored object), ask the user and either withdraw these contents or open a new window for the explorer.
Note that I consider this patch rather a temporary hotfix than a final solution. In the long term, we should try to communicate specific selectors (here: #expression) for requests such as #acceptChanges or #wantToChange instead.
=============== Diff against Tools-mt.1125 ===============
Item was changed:
----- Method: Inspector>>replaceInspectorWithExplorer (in category 'toolbuilder') -----
replaceInspectorWithExplorer
"Switch to an explorer tool. If there are custom fields, the user can choose to not discard them, which will just spawn a new explorer tool besides this inspector."
| window currentBounds |
+ self flag: #todo. "ct: In the long term, we should try to communicate specific selectors (here: #expression) along the observer pattern for requests such as #acceptChanges or #wantToChange instead of exploiting contentsTyped etc."
+
+ (self okToDiscardCustomFields and: [contentsTyped notNil ==> [self confirm:
+ 'Changes have not been saved.
+ Is it OK to cancel those changes?' translated orCancel: [^ self]]])
- self okToDiscardCustomFields
ifFalse: [^ self object explore].
self customFields removeAll.
+ self changed: #contents. "Reset value pane contents before accepting all contents"
self changed: #acceptChanges. "We copy the current state anyway. See below."
currentBounds := ToolBuilder default class getBoundsForWindow: self containingWindow.
"Close first because MVC fiddles around with processes."
self changed: #close.
window := ToolSet explore: self object.
"---- In MVC, the lines after this will not be executed ---"
window model setExpression: self expression.
ToolBuilder default class setBoundsForWindow: window to: currentBounds.!