diff --git a/src/PharoCompatibility-Core/PharoCompatibility.class.st b/src/PharoCompatibility-Core/PharoCompatibility.class.st index c8cc204..7b099b9 100644 --- a/src/PharoCompatibility-Core/PharoCompatibility.class.st +++ b/src/PharoCompatibility-Core/PharoCompatibility.class.st @@ -9,12 +9,6 @@ Class { #tag : 'Core' } -{ #category : 'accessing' } -PharoCompatibility class >> currentMajorVersion [ - - ^ SystemVersion current major -] - { #category : 'errors' } PharoCompatibility class >> compilationAstFromException: anError [ @@ -28,6 +22,12 @@ PharoCompatibility class >> compilationAstFromException: anError [ do: [ :ignored | nil ] ] +{ #category : 'accessing' } +PharoCompatibility class >> currentMajorVersion [ + + ^ SystemVersion current major +] + { #category : 'private' } PharoCompatibility class >> firstExistingGlobalFrom: globalNames [ @@ -72,29 +72,6 @@ PharoCompatibility class >> installMissingGlobalNamed: missingGlobalName from: r ^ replacement ] -{ #category : 'errors' } -PharoCompatibility class >> noticeFromException: anError ifKindOfAnyNamed: classNames [ - - | candidate | - candidate := anError. - (anError respondsTo: #notice) ifTrue: [ - anError notice ifNotNil: [ :notice | candidate := notice ] ]. - ^ (self object: candidate isKindOfAnyClassNamed: classNames) - ifTrue: [ candidate ] - ifFalse: [ nil ] -] - -{ #category : 'private' } -PharoCompatibility class >> object: anObject isKindOfAnyClassNamed: classNames [ - - classNames do: [ :className | - | class | - class := Smalltalk at: className ifAbsent: [ nil ]. - (class notNil and: [ anObject isKindOf: class ]) ifTrue: [ - ^ true ] ]. - ^ false -] - { #category : 'installing' } PharoCompatibility class >> installPharo12Surface [ @@ -145,6 +122,29 @@ PharoCompatibility class >> loadedSurfaces [ ^ surfaces asArray ] +{ #category : 'errors' } +PharoCompatibility class >> noticeFromException: anError ifKindOfAnyNamed: classNames [ + + | candidate | + candidate := anError. + (anError respondsTo: #notice) ifTrue: [ + anError notice ifNotNil: [ :notice | candidate := notice ] ]. + ^ (self object: candidate isKindOfAnyClassNamed: classNames) + ifTrue: [ candidate ] + ifFalse: [ nil ] +] + +{ #category : 'private' } +PharoCompatibility class >> object: anObject isKindOfAnyClassNamed: classNames [ + + classNames do: [ :className | + | class | + class := Smalltalk at: className ifAbsent: [ nil ]. + (class notNil and: [ anObject isKindOf: class ]) ifTrue: [ + ^ true ] ]. + ^ false +] + { #category : 'errors' } PharoCompatibility class >> resumeDeprecationsDuring: aBlock [ diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo14-Tests/PharoCompatibilityP13SurfacePharo14Test.class.st b/src/PharoCompatibility-Pharo13Surface-Pharo14-Tests/PharoCompatibilityP13SurfacePharo14Test.class.st index 2f081f3..3503c84 100644 --- a/src/PharoCompatibility-Pharo13Surface-Pharo14-Tests/PharoCompatibilityP13SurfacePharo14Test.class.st +++ b/src/PharoCompatibility-Pharo13Surface-Pharo14-Tests/PharoCompatibilityP13SurfacePharo14Test.class.st @@ -87,6 +87,15 @@ PharoCompatibilityP13SurfacePharo14Test >> testMoveClassRefactoringUsesTheClassB self removePackageNamed: packageName ] ] +{ #category : 'tests' } +PharoCompatibilityP13SurfacePharo14Test >> testPharo13ContextTempNamesSelector [ + + | names temporaryValue | + temporaryValue := 42. + names := thisContext tempNames collect: [ :each | each asString ]. + self assert: (names includes: 'temporaryValue') +] + { #category : 'tests' } PharoCompatibilityP13SurfacePharo14Test >> testUndeclaredVariableNodeFromCompilationError [ diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo14/Context.extension.st b/src/PharoCompatibility-Pharo13Surface-Pharo14/Context.extension.st new file mode 100644 index 0000000..ee12f80 --- /dev/null +++ b/src/PharoCompatibility-Pharo13Surface-Pharo14/Context.extension.st @@ -0,0 +1,7 @@ +Extension { #name : 'Context' } + +{ #category : '*PharoCompatibility-Pharo13Surface-Pharo14' } +Context >> tempNames [ + + ^ self temporaryVariableNames +]