Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/PharoCompatibility-Core/Exception.extension.st
Original file line number Diff line number Diff line change
@@ -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
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : 'CodeError' }

{ #category : '*PharoCompatibility-Pharo13Surface-Pharo12' }
CodeError >> pharoCompatibilitySyntaxNotice [

^ self notice
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : 'OCUndeclaredVariableWarning' }

{ #category : '*PharoCompatibility-Pharo13Surface-Pharo12' }
OCUndeclaredVariableWarning >> pharoCompatibilityUndeclaredVariableNode [

^ self notice node
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Extension { #name : 'PharoCompatibility' }
{ #category : '*PharoCompatibility-Pharo13Surface-Pharo12' }
PharoCompatibility class >> compilationAstFromException: anError [

^ nil
^ anError pharoCompatibilityCompilationAst
]

{ #category : '*PharoCompatibility-Pharo13Surface-Pharo12' }
Expand All @@ -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
]
Original file line number Diff line number Diff line change
@@ -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 ]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : 'OCUndeclaredVariableNotice' }

{ #category : '*PharoCompatibility-Pharo13Surface-Pharo13' }
OCUndeclaredVariableNotice >> pharoCompatibilityUndeclaredVariableNode [

^ self node
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : 'OCUndeclaredVariableWarning' }

{ #category : '*PharoCompatibility-Pharo13Surface-Pharo13' }
OCUndeclaredVariableWarning >> pharoCompatibilityUndeclaredVariableNode [

^ self node
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Extension { #name : 'PharoCompatibility' }
{ #category : '*PharoCompatibility-Pharo13Surface-Pharo13' }
PharoCompatibility class >> compilationAstFromException: anError [

^ nil
^ anError pharoCompatibilityCompilationAst
]

{ #category : '*PharoCompatibility-Pharo13Surface-Pharo13' }
Expand All @@ -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
]
Original file line number Diff line number Diff line change
@@ -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
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Extension { #name : 'PharoCompatibility' }
{ #category : '*PharoCompatibility-Pharo13Surface-Pharo14' }
PharoCompatibility class >> compilationAstFromException: anError [

^ anError compilationResult ast
^ anError pharoCompatibilityCompilationAst
]

{ #category : '*PharoCompatibility-Pharo13Surface-Pharo14' }
Expand All @@ -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' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
Loading