A new version of KernelTests was added to project The Inbox:
http://source.squeak.org/inbox/KernelTests-ct.387.mcz
==================== Summary ====================
Name: KernelTests-ct.387
Author: ct
Time: 24 October 2020, 12:40:40.526058 am
UUID: aa73c56f-88e1-3b4d-9d59-fb29df3363a7
Ancestors: KernelTests-ul.386
Adds regression test for Kernel-ct.1355 (source logging after SyntaxError). Should I invest further complexity into this test for the purpose of keeping the production source logs clean?
=============== Diff against KernelTests-ul.386 ===============
Item was added:
+ ----- Method: ClassDescriptionTest>>testLogSourceAfterReparseSyntaxError (in category 'testing') -----
+ testLogSourceAfterReparseSyntaxError
+
+ | class source |
+ SystemChangeNotifier uniqueInstance doSilently: [[
+ class := Object newSubclass.
+ source := 'foo [x'.
+ [class compile: source]
+ on: SyntaxErrorNotification do: [:error |
+ error resume: (source := source , ']')].
+ self assert: source equals: (class sourceCodeAt: #foo) asString.
+ ] ensure: [class removeFromSystem]].!
Item was changed:
+ ----- Method: ClassDescriptionTest>>testOrganization (in category 'testing') -----
- ----- Method: ClassDescriptionTest>>testOrganization (in category 'tests') -----
testOrganization
| aClassOrganizer |
aClassOrganizer := ClassDescription organization.
self assert: (aClassOrganizer isKindOf: ClassOrganizer).!
Christoph Thiede uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-ct.387.mcz
==================== Summary ====================
Name: KernelTests-ct.387
Author: ct
Time: 24 October 2020, 12:40:40.526058 am
UUID: aa73c56f-88e1-3b4d-9d59-fb29df3363a7
Ancestors: KernelTests-ul.386
Adds regression test for Kernel-ct.1355 (source logging after SyntaxError). Should I invest further complexity into this test for the purpose of keeping the production source logs clean?
=============== Diff against KernelTests-ul.386 ===============
Item was added:
+ ----- Method: ClassDescriptionTest>>testLogSourceAfterReparseSyntaxError (in category 'testing') -----
+ testLogSourceAfterReparseSyntaxError
+
+ | class source |
+ SystemChangeNotifier uniqueInstance doSilently: [[
+ class := Object newSubclass.
+ source := 'foo [x'.
+ [class compile: source]
+ on: SyntaxErrorNotification do: [:error |
+ error resume: (source := source , ']')].
+ self assert: source equals: (class sourceCodeAt: #foo) asString.
+ ] ensure: [class removeFromSystem]].!
Item was changed:
+ ----- Method: ClassDescriptionTest>>testOrganization (in category 'testing') -----
- ----- Method: ClassDescriptionTest>>testOrganization (in category 'tests') -----
testOrganization
| aClassOrganizer |
aClassOrganizer := ClassDescription organization.
self assert: (aClassOrganizer isKindOf: ClassOrganizer).!
Christoph Thiede uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-ct.496.mcz
==================== Summary ====================
Name: Compiler-ct.496
Author: ct
Time: 24 February 2024, 9:33:48.264459 pm
UUID: 8600e29a-71b6-3347-9990-efef5c84e76d
Ancestors: Compiler-mt.495
Fixes source logging after fixing a syntax error. In the past, the old source was stored in the logs instead of the new one.
=============== Diff against Compiler-mt.495 ===============
Item was changed:
----- Method: Compiler>>compiledMethodFor:in:to:notifying:ifFail: (in category 'public access') -----
compiledMethodFor: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock
- "Compiles the sourceStream into a parse tree, then generates code
- into a method, and answers it. If receiver is not nil, then the text can
- refer to instance variables of that receiver (the Inspector uses this).
- If aContext is not nil, the text can refer to temporaries in that context
- (the Debugger uses this). If aRequestor is not nil, then it will receive a
- notify:at: message before the attempt to evaluate is aborted."
+ ^ self
+ compiledMethodFor: textOrStream
+ in: aContext
+ to: receiver
- | methodNode method |
- methodNode := self
- compileNoPattern: textOrStream
- in: (self classForReceiver: receiver context: aContext)
- context: aContext
notifying: aRequestor
+ ifFail: failBlock
+ logged: false!
- ifFail: [^failBlock value].
- method := self interactive
- ifTrue: [ methodNode generateWithTempNames ]
- ifFalse: [ methodNode generate ].
- ^method!
Item was changed:
----- Method: Compiler>>compiledMethodFor:in:to:notifying:ifFail:logged: (in category 'public access logging') -----
compiledMethodFor: textOrStream in: aContext to: receiver notifying: aRequestor ifFail: failBlock logged: logFlag
"Compiles the sourceStream into a parse tree, then generates code
into a method, and answers it. If receiver is not nil, then the text can
refer to instance variables of that receiver (the Inspector uses this).
If aContext is not nil, the text can refer to temporaries in that context
(the Debugger uses this). If aRequestor is not nil, then it will receive a
notify:at: message before the attempt to evaluate is aborted."
+ | methodNode method |
+ methodNode := self
+ compileNoPattern: textOrStream
+ in: (self classForReceiver: receiver context: aContext)
+ context: aContext
- | method |
- method := self
- compiledMethodFor: textOrStream
- in: aContext
- to: receiver
notifying: aRequestor
ifFail: [^failBlock value].
+ method := self interactive
+ ifTrue: [ methodNode generateWithTempNames ]
+ ifFalse: [ methodNode generate ].
+
logFlag ifTrue:
+ [SystemChangeNotifier uniqueInstance
+ evaluated: (methodNode basicSourceText ifNil: [cue stringToLog]) "honor possible source updates (e.g., due to ReparseAfterSourceEditing)"
+ context: aContext].
+
- [SystemChangeNotifier uniqueInstance evaluated: cue stringToLog context: aContext].
^method!
Item was changed:
----- Method: Compiler>>evaluateCue:ifFail: (in category 'private') -----
evaluateCue: aCue ifFail: failBlock
- "Compiles the cue source into a parse tree, then generates code into
- a method. Finally, the compiled method is invoked from here via withArgs:executeMethod:, hence the system no longer creates Doit method
- litter on errors."
+ ^ self
+ evaluateCue: aCue
+ ifFail: failBlock
+ logged: false!
- | methodNode method value |
- methodNode := self compileCue: aCue noPattern: true ifFail: [^failBlock value].
-
- method := self interactive
- ifTrue: [methodNode generateWithTempNames]
- ifFalse: [methodNode generate].
-
- value := cue receiver
- withArgs: (cue context ifNil: [#()] ifNotNil: [{cue context}])
- executeMethod: method.
- ^ value
- !
Item was changed:
----- Method: Compiler>>evaluateCue:ifFail:logged: (in category 'private') -----
evaluateCue: aCue ifFail: failBlock logged: logFlag
"Compiles the cue source into a parse tree, then generates code into
a method. Finally, the compiled method is invoked from here via withArgs:executeMethod:, hence the system no longer creates Doit method
litter on errors."
+ | methodNode method value |
+ methodNode := self compileCue: aCue noPattern: true ifFail: [^failBlock value].
+
+ method := self interactive
+ ifTrue: [methodNode generateWithTempNames]
+ ifFalse: [methodNode generate].
+
+ value := cue receiver
+ withArgs: (cue context ifNil: [#()] ifNotNil: [{cue context}])
+ executeMethod: method.
+
- | value |
- value := self evaluateCue: aCue ifFail: [^failBlock value].
logFlag ifTrue:
+ [SystemChangeNotifier uniqueInstance
+ evaluated: (methodNode basicSourceText ifNil: [cue stringToLog]) "honor possible source updates (e.g., due to ReparseAfterSourceEditing)"
+ context: cue context].
+
+ ^ value!
- [SystemChangeNotifier uniqueInstance evaluated: cue stringToLog context: cue context].
- ^ value
- !
Item was added:
+ ----- Method: MethodNode>>basicSourceText (in category 'printing') -----
+ basicSourceText
+
+ ^ sourceText!
Christoph Thiede uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-ct.452.mcz
==================== Summary ====================
Name: KernelTests-ct.452
Author: ct
Time: 24 February 2024, 9:33:33.756459 pm
UUID: bd37e2b7-1de0-ac4f-8130-78ccabfdb249
Ancestors: KernelTests-ct.451, KernelTests-ct.376, KernelTests-ct.387
KernelTests-ct.387:
Adds regression test for Kernel-ct.1355 (source logging after SyntaxError).
Revision: Document side effect to changes file.
=============== Diff against KernelTests-ct.451 ===============
Item was added:
+ ----- Method: ClassDescriptionTest>>testLogSourceAfterReparseSyntaxError (in category 'tests') -----
+ testLogSourceAfterReparseSyntaxError
+
+ | class source |
+ SystemChangeNotifier uniqueInstance doSilently: "NB: this silences logging of subclass creation/deletion but not logging of #compile:, which is part of the functionality under test"
+ [[class := Object newSubclass.
+ source := 'foo [x'.
+ [class compile: source]
+ on: SyntaxErrorNotification do: [:error |
+ error retryWithNewSource: (source := source , ']')].
+ self assert: source equals: (class sourceCodeAt: #foo) asString]
+ ensure: [class removeFromSystem]].!
Nicolas Cellier uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-nice.1294.mcz
==================== Summary ====================
Name: Kernel-nice.1294
Author: nice
Time: 6 February 2020, 10:00:19.603883 pm
UUID: c78e67da-95e5-42ad-af82-089c149f165d
Ancestors: Kernel-tonyg.1293
Complex log function was missing (base 10 logarithm)
Complex already provides ln and log:, so why not log?
=============== Diff against Kernel-tonyg.1293 ===============
Item was added:
+ ----- Method: Complex>>log (in category 'mathematical functions') -----
+ log
+ "Answer the base 10 logarithm of the receiver."
+
+ ^self ln / 10 ln!
Christoph Thiede uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ct.1293.mcz
==================== Summary ====================
Name: Kernel-ct.1293
Author: ct
Time: 8 January 2020, 11:11:21.431206 am
UUID: 86f4d70b-c53c-5a45-97f3-1bff2d65cdb4
Ancestors: Kernel-nice.1292
Elaborate method comment in Object >> #copyFrom:
=============== Diff against Kernel-nice.1292 ===============
Item was changed:
----- Method: Object>>copyFrom: (in category 'copying') -----
copyFrom: anotherObject
+ "Copy to myself all instance variables I have in common with anotherObject, i. e. those which have the same index in both class definitions. This is dangerous because it ignores an object's control over its own inst vars."
- "Copy to myself all instance variables I have in common with anotherObject. This is dangerous because it ignores an object's control over its own inst vars. "
| mine his |
<primitive: 168>
mine := self class allInstVarNames.
his := anotherObject class allInstVarNames.
1 to: (mine size min: his size) do: [:ind |
(mine at: ind) = (his at: ind) ifTrue: [
self instVarAt: ind put: (anotherObject instVarAt: ind)]].
self class isVariable & anotherObject class isVariable ifTrue: [
1 to: (self basicSize min: anotherObject basicSize) do: [:ind |
self basicAt: ind put: (anotherObject basicAt: ind)]].!
Item was changed:
----- Method: Object>>copySameFrom: (in category 'copying') -----
copySameFrom: otherObject
+ "Copy to myself all instance variables named the same in otherObject. This is dangerous because it ignores an object's control over its own inst vars."
- "Copy to myself all instance variables named the same in otherObject.
- This ignores otherObject's control over its own inst vars."
| myInstVars otherInstVars |
myInstVars := self class allInstVarNames.
otherInstVars := otherObject class allInstVarNames.
myInstVars doWithIndex: [:each :index |
| match |
(match := otherInstVars indexOf: each) > 0 ifTrue:
[self instVarAt: index put: (otherObject instVarAt: match)]].
1 to: (self basicSize min: otherObject basicSize) do: [:i |
self basicAt: i put: (otherObject basicAt: i)].
!
I think I fixed it, the original on my image was missing the assignment (this is approximate, i didn't record the original code exactly):
(dropee isKindOf: TransferMorph)
ifTrue: [reference := dropee passenger.
externalName := dropee passenger className]
ifFalse: [reference := dropee.
].
And instead just left externalName as nil, so when you got to "externalName := externalName isOctetString" it reported an unknown object.
I changed it to:
(dropee isKindOf: TransferMorph)
ifTrue: [reference := dropee passenger.
externalName := dropee passenger className]
ifFalse: [reference := dropee.
externalName := dropee externalName].
(just adding the assignment to externalName)
This was a Squeak 5.1 32 bit image, You should be able to just look at the code and it's obviously wrong. If you want to reproduce, open a workspace, open any new morph with openInWorld, set the workspace to create textual references to dropped morphs, and drag and drop the morph on the workspace.
I'm trying to build a GUI, pretty much a beginner.
Here's the fixed code:
-------------------------------------
acceptDroppingMorph: dropee event: evt inMorph: targetMorph
"Return the dropee to its old position, and add a reference to it at the
cursor point."
| bindingName externalName reference |
(dropee isKindOf: TransferMorph)
ifTrue: [reference := dropee passenger.
externalName := dropee passenger className]
ifFalse: [reference := dropee.
externalName := dropee externalName].
externalName := externalName isOctetString
ifTrue: [externalName]
ifFalse: ['a' , externalName].
bindingName := externalName withFirstCharacterDownshifted , reference identityHash printString.
targetMorph correctSelectionWithString: bindingName , ' '.
(self bindingOf: bindingName)
value: reference.
(dropee isKindOf: TransferMorph)
ifFalse: [dropee rejectDropMorphEvent: evt].
^ true"success"
--
Reply to this email directly or view it on GitHub:
https://github.com/squeak-smalltalk/squeak-object-memory/issues/118
You are receiving this because you are subscribed to this thread.
Message ID: <squeak-smalltalk/squeak-object-memory/issues/118(a)github.com>