diff --git a/src/PharoCompatibility-Core/Exception.extension.st b/src/PharoCompatibility-Core/Exception.extension.st new file mode 100644 index 0000000..be959ea --- /dev/null +++ b/src/PharoCompatibility-Core/Exception.extension.st @@ -0,0 +1,19 @@ +Extension { #name : 'Exception' } + +{ #category : '*PharoCompatibility-Core' } +Exception >> pharoCompatibilityCompilationAst [ + + ^ nil +] + +{ #category : '*PharoCompatibility-Core' } +Exception >> pharoCompatibilitySyntaxNotice [ + + ^ nil +] + +{ #category : '*PharoCompatibility-Core' } +Exception >> pharoCompatibilityUndeclaredVariableNode [ + + ^ nil +] diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo12/CodeError.extension.st b/src/PharoCompatibility-Pharo13Surface-Pharo12/CodeError.extension.st new file mode 100644 index 0000000..ff88a0e --- /dev/null +++ b/src/PharoCompatibility-Pharo13Surface-Pharo12/CodeError.extension.st @@ -0,0 +1,7 @@ +Extension { #name : 'CodeError' } + +{ #category : '*PharoCompatibility-Pharo13Surface-Pharo12' } +CodeError >> pharoCompatibilitySyntaxNotice [ + + ^ self notice +] diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo12/OCUndeclaredVariableWarning.extension.st b/src/PharoCompatibility-Pharo13Surface-Pharo12/OCUndeclaredVariableWarning.extension.st new file mode 100644 index 0000000..3702cc5 --- /dev/null +++ b/src/PharoCompatibility-Pharo13Surface-Pharo12/OCUndeclaredVariableWarning.extension.st @@ -0,0 +1,7 @@ +Extension { #name : 'OCUndeclaredVariableWarning' } + +{ #category : '*PharoCompatibility-Pharo13Surface-Pharo12' } +OCUndeclaredVariableWarning >> pharoCompatibilityUndeclaredVariableNode [ + + ^ self notice node +] diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo12/PharoCompatibility.extension.st b/src/PharoCompatibility-Pharo13Surface-Pharo12/PharoCompatibility.extension.st index 6e74c00..fd3205e 100644 --- a/src/PharoCompatibility-Pharo13Surface-Pharo12/PharoCompatibility.extension.st +++ b/src/PharoCompatibility-Pharo13Surface-Pharo12/PharoCompatibility.extension.st @@ -3,7 +3,7 @@ Extension { #name : 'PharoCompatibility' } { #category : '*PharoCompatibility-Pharo13Surface-Pharo12' } PharoCompatibility class >> compilationAstFromException: anError [ - ^ nil + ^ anError pharoCompatibilityCompilationAst ] { #category : '*PharoCompatibility-Pharo13Surface-Pharo12' } @@ -28,13 +28,11 @@ PharoCompatibility class >> syntaxErrorNoticeClassName [ { #category : '*PharoCompatibility-Pharo13Surface-Pharo12' } PharoCompatibility class >> syntaxNoticeFromException: anError [ - (anError isKindOf: CodeError) ifFalse: [ ^ nil ]. - ^ anError notice + ^ anError pharoCompatibilitySyntaxNotice ] { #category : '*PharoCompatibility-Pharo13Surface-Pharo12' } PharoCompatibility class >> undeclaredVariableNodeFromException: anError [ - (anError isKindOf: OCUndeclaredVariableWarning) ifFalse: [ ^ nil ]. - ^ anError notice node + ^ anError pharoCompatibilityUndeclaredVariableNode ] diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo13/OCCodeError.extension.st b/src/PharoCompatibility-Pharo13Surface-Pharo13/OCCodeError.extension.st new file mode 100644 index 0000000..063e069 --- /dev/null +++ b/src/PharoCompatibility-Pharo13Surface-Pharo13/OCCodeError.extension.st @@ -0,0 +1,14 @@ +Extension { #name : 'OCCodeError' } + +{ #category : '*PharoCompatibility-Pharo13Surface-Pharo13' } +OCCodeError >> pharoCompatibilitySyntaxNotice [ + + ^ self notice +] + +{ #category : '*PharoCompatibility-Pharo13Surface-Pharo13' } +OCCodeError >> pharoCompatibilityUndeclaredVariableNode [ + + ^ self notice ifNotNil: [ :syntaxNotice | + syntaxNotice pharoCompatibilityUndeclaredVariableNode ] +] diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo13/OCUndeclaredVariableNotice.extension.st b/src/PharoCompatibility-Pharo13Surface-Pharo13/OCUndeclaredVariableNotice.extension.st new file mode 100644 index 0000000..9fb5f80 --- /dev/null +++ b/src/PharoCompatibility-Pharo13Surface-Pharo13/OCUndeclaredVariableNotice.extension.st @@ -0,0 +1,7 @@ +Extension { #name : 'OCUndeclaredVariableNotice' } + +{ #category : '*PharoCompatibility-Pharo13Surface-Pharo13' } +OCUndeclaredVariableNotice >> pharoCompatibilityUndeclaredVariableNode [ + + ^ self node +] diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo13/OCUndeclaredVariableWarning.extension.st b/src/PharoCompatibility-Pharo13Surface-Pharo13/OCUndeclaredVariableWarning.extension.st new file mode 100644 index 0000000..8c7ab54 --- /dev/null +++ b/src/PharoCompatibility-Pharo13Surface-Pharo13/OCUndeclaredVariableWarning.extension.st @@ -0,0 +1,7 @@ +Extension { #name : 'OCUndeclaredVariableWarning' } + +{ #category : '*PharoCompatibility-Pharo13Surface-Pharo13' } +OCUndeclaredVariableWarning >> pharoCompatibilityUndeclaredVariableNode [ + + ^ self node +] diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo13/PharoCompatibility.extension.st b/src/PharoCompatibility-Pharo13Surface-Pharo13/PharoCompatibility.extension.st index 113e60b..697e5ca 100644 --- a/src/PharoCompatibility-Pharo13Surface-Pharo13/PharoCompatibility.extension.st +++ b/src/PharoCompatibility-Pharo13Surface-Pharo13/PharoCompatibility.extension.st @@ -3,7 +3,7 @@ Extension { #name : 'PharoCompatibility' } { #category : '*PharoCompatibility-Pharo13Surface-Pharo13' } PharoCompatibility class >> compilationAstFromException: anError [ - ^ nil + ^ anError pharoCompatibilityCompilationAst ] { #category : '*PharoCompatibility-Pharo13Surface-Pharo13' } @@ -27,11 +27,11 @@ PharoCompatibility class >> syntaxErrorNoticeClassName [ { #category : '*PharoCompatibility-Pharo13Surface-Pharo13' } PharoCompatibility class >> syntaxNoticeFromException: anError [ - ^ anError notice + ^ anError pharoCompatibilitySyntaxNotice ] { #category : '*PharoCompatibility-Pharo13Surface-Pharo13' } PharoCompatibility class >> undeclaredVariableNodeFromException: anError [ - ^ anError notice node + ^ anError pharoCompatibilityUndeclaredVariableNode ] diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo14/OCCompilationError.extension.st b/src/PharoCompatibility-Pharo13Surface-Pharo14/OCCompilationError.extension.st new file mode 100644 index 0000000..feb067d --- /dev/null +++ b/src/PharoCompatibility-Pharo13Surface-Pharo14/OCCompilationError.extension.st @@ -0,0 +1,14 @@ +Extension { #name : 'OCCompilationError' } + +{ #category : '*PharoCompatibility-Pharo13Surface-Pharo14' } +OCCompilationError >> pharoCompatibilityCompilationAst [ + + ^ self compilationResult ast +] + +{ #category : '*PharoCompatibility-Pharo13Surface-Pharo14' } +OCCompilationError >> pharoCompatibilityUndeclaredVariableNode [ + + ^ PharoCompatibility undeclaredVariableNodeInAst: + self pharoCompatibilityCompilationAst +] diff --git a/src/PharoCompatibility-Pharo13Surface-Pharo14/PharoCompatibility.extension.st b/src/PharoCompatibility-Pharo13Surface-Pharo14/PharoCompatibility.extension.st index 11f508d..59933b0 100644 --- a/src/PharoCompatibility-Pharo13Surface-Pharo14/PharoCompatibility.extension.st +++ b/src/PharoCompatibility-Pharo13Surface-Pharo14/PharoCompatibility.extension.st @@ -3,7 +3,7 @@ Extension { #name : 'PharoCompatibility' } { #category : '*PharoCompatibility-Pharo13Surface-Pharo14' } PharoCompatibility class >> compilationAstFromException: anError [ - ^ anError compilationResult ast + ^ anError pharoCompatibilityCompilationAst ] { #category : '*PharoCompatibility-Pharo13Surface-Pharo14' } @@ -27,14 +27,13 @@ PharoCompatibility class >> syntaxErrorNoticeClassName [ { #category : '*PharoCompatibility-Pharo13Surface-Pharo14' } PharoCompatibility class >> syntaxNoticeFromException: anError [ - ^ nil + ^ anError pharoCompatibilitySyntaxNotice ] { #category : '*PharoCompatibility-Pharo13Surface-Pharo14' } PharoCompatibility class >> undeclaredVariableNodeFromException: anError [ - ^ self undeclaredVariableNodeInAst: - (anError compilationResult ast) + ^ anError pharoCompatibilityUndeclaredVariableNode ] { #category : '*PharoCompatibility-Pharo13Surface-Pharo14' } diff --git a/src/PharoCompatibility-Tests/PharoCompatibilityP13SurfaceTest.class.st b/src/PharoCompatibility-Tests/PharoCompatibilityP13SurfaceTest.class.st index 76a5a3c..b8f4fec 100644 --- a/src/PharoCompatibility-Tests/PharoCompatibilityP13SurfaceTest.class.st +++ b/src/PharoCompatibility-Tests/PharoCompatibilityP13SurfaceTest.class.st @@ -41,3 +41,13 @@ PharoCompatibilityP13SurfaceTest >> assertPharo13SurfaceProvidesMillisecondSemap self assert: (Semaphore new waitTimeoutMilliseconds: 1) ] + +{ #category : 'tests' } +PharoCompatibilityP13SurfaceTest >> testCompilerExceptionHelpersIgnoreOrdinaryExceptions [ + + | exception | + exception := MessageNotUnderstood new. + self assert: (PharoCompatibility syntaxNoticeFromException: exception) isNil. + self assert: (PharoCompatibility undeclaredVariableNodeFromException: exception) isNil. + self assert: (PharoCompatibility compilationAstFromException: exception) isNil +]