From e638ce9829adce5daba3d6fd32d573ad0bfb1dec Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Wed, 13 Nov 2024 15:35:02 +0100 Subject: [PATCH] Remove some of the last users of `SystemAnnouncer uniqueInstance` And remove a trace forgotten in Rubric --- .../ClySystemEnvironment.class.st | 13 +++++++------ src/OpalCompiler-Core/OpalCompiler.class.st | 2 +- src/OpalCompiler-Tests/OCArrayLiteralTest.class.st | 2 +- src/OpalCompiler-Tests/OCCompilerTest.class.st | 3 ++- .../RBRefactoringChangeTest.class.st | 8 ++++---- .../RBAbstractTransformationTest.class.st | 8 ++++---- src/Rubric/RubTextEditor.class.st | 1 - 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/Calypso-SystemQueries/ClySystemEnvironment.class.st b/src/Calypso-SystemQueries/ClySystemEnvironment.class.st index f24f428ee23..0d9089a08b3 100644 --- a/src/Calypso-SystemQueries/ClySystemEnvironment.class.st +++ b/src/Calypso-SystemQueries/ClySystemEnvironment.class.st @@ -41,12 +41,13 @@ Class { { #category : 'accessing' } ClySystemEnvironment class >> currentImage [ - ^currentImage ifNil: [ - currentImage := self new - name: 'Current image'; - globals: Smalltalk globals; - packageOrganizer: PackageOrganizer default; - changesAnnouncer: SystemAnnouncer uniqueInstance] + + ^ currentImage ifNil: [ + currentImage := self new + name: 'Current image'; + globals: Smalltalk globals; + packageOrganizer: PackageOrganizer default; + changesAnnouncer: self codeChangeAnnouncer ] ] { #category : 'class initialization' } diff --git a/src/OpalCompiler-Core/OpalCompiler.class.st b/src/OpalCompiler-Core/OpalCompiler.class.st index 30f3dfb46d4..70abb3ef9ad 100644 --- a/src/OpalCompiler-Core/OpalCompiler.class.st +++ b/src/OpalCompiler-Core/OpalCompiler.class.st @@ -467,7 +467,7 @@ OpalCompiler >> evaluate [ ast ifNil: [ ^ doItMethod ]. value := self semanticScope evaluateDoIt: doItMethod. - self logged == true ifTrue: [ self semanticScope announceDoItEvaluation: source by: SystemAnnouncer uniqueInstance ]. + self logged == true ifTrue: [ self semanticScope announceDoItEvaluation: source by: self class codeSupportAnnouncer ]. ^ value ] diff --git a/src/OpalCompiler-Tests/OCArrayLiteralTest.class.st b/src/OpalCompiler-Tests/OCArrayLiteralTest.class.st index efcf4d104f9..762f9192d6e 100644 --- a/src/OpalCompiler-Tests/OCArrayLiteralTest.class.st +++ b/src/OpalCompiler-Tests/OCArrayLiteralTest.class.st @@ -9,7 +9,7 @@ Class { { #category : 'running' } OCArrayLiteralTest >> runCase [ - SystemAnnouncer uniqueInstance suspendAllWhile: [ super runCase ] + self class codeChangeAnnouncer suspendAllWhile: [ super runCase ] ] { #category : 'running' } diff --git a/src/OpalCompiler-Tests/OCCompilerTest.class.st b/src/OpalCompiler-Tests/OCCompilerTest.class.st index 7441c333e9f..9d4cc45bda9 100644 --- a/src/OpalCompiler-Tests/OCCompilerTest.class.st +++ b/src/OpalCompiler-Tests/OCCompilerTest.class.st @@ -53,7 +53,8 @@ OCCompilerTest >> notify: aString at: aSmallInteger in: aReadStream [ { #category : 'running' } OCCompilerTest >> runCase [ - SystemAnnouncer uniqueInstance suspendAllWhile: [ super runCase ] + + self class codeChangeAnnouncer suspendAllWhile: [ super runCase ] ] { #category : 'running' } diff --git a/src/Refactoring-Changes-Tests/RBRefactoringChangeTest.class.st b/src/Refactoring-Changes-Tests/RBRefactoringChangeTest.class.st index 705f0bba6e3..1576f9db4f8 100644 --- a/src/Refactoring-Changes-Tests/RBRefactoringChangeTest.class.st +++ b/src/Refactoring-Changes-Tests/RBRefactoringChangeTest.class.st @@ -50,10 +50,10 @@ RBRefactoringChangeTest >> exampleTraits [ RBRefactoringChangeTest >> performAndUndoChange: aChange do: aBlock [ "Perform a change in the system silently, evaluate aBlock and then undo the change again." - | undo | - ^ SystemAnnouncer uniqueInstance suspendAllWhile: [ - undo := aChange execute. - aBlock ensure: [ undo execute ] ] + ^ self class codeChangeAnnouncer suspendAllWhile: [ + | undo | + undo := aChange execute. + aBlock ensure: [ undo execute ] ] ] { #category : 'mocking' } diff --git a/src/Refactoring-Transformations-Tests/RBAbstractTransformationTest.class.st b/src/Refactoring-Transformations-Tests/RBAbstractTransformationTest.class.st index 81922742157..b52c23725fe 100644 --- a/src/Refactoring-Transformations-Tests/RBAbstractTransformationTest.class.st +++ b/src/Refactoring-Transformations-Tests/RBAbstractTransformationTest.class.st @@ -32,10 +32,10 @@ RBAbstractTransformationTest >> parserClass [ RBAbstractTransformationTest >> performAndUndoChange: aChange do: aBlock [ "Perform a change in the system silently, evaluate aBlock and then undo the change again." - | undo | - ^ SystemAnnouncer uniqueInstance suspendAllWhile: [ - undo := aChange execute. - aBlock ensure: [ undo execute ] ] + ^ self class codeChangeAnnouncer suspendAllWhile: [ + | undo | + undo := aChange execute. + aBlock ensure: [ undo execute ] ] ] { #category : 'running' } diff --git a/src/Rubric/RubTextEditor.class.st b/src/Rubric/RubTextEditor.class.st index f4328ea5abe..7af12c19368 100644 --- a/src/Rubric/RubTextEditor.class.st +++ b/src/Rubric/RubTextEditor.class.st @@ -1661,7 +1661,6 @@ RubTextEditor >> nextWord: position [ Position N + 1 is after the Nth character" initialPosition := 1 max: position. index := initialPosition. - position traceCr. string := self string. size := string size + 1.