From 2cd549c971d01489cdd561ac791f609109d8a06e Mon Sep 17 00:00:00 2001 From: Marcus Denker Date: Wed, 13 May 2020 16:32:14 +0200 Subject: [PATCH] - #notifty:at: is just used in OCSemanticError Hierarchy, remove it from OCSemanticWarning - OCReadOnlyVMWarning is not needed anymore: all VMs support read only objects - add #requestor to OCSemanticError and simplify notify:at: there --- .../CompilationContext.class.st | 2 -- .../OCReadOnlyVMWarning.class.st | 33 ------------------- .../OCSemanticError.class.st | 15 +++++---- .../OCSemanticWarning.class.st | 17 ---------- 4 files changed, 9 insertions(+), 58 deletions(-) delete mode 100644 src/OpalCompiler-Core/OCReadOnlyVMWarning.class.st diff --git a/src/OpalCompiler-Core/CompilationContext.class.st b/src/OpalCompiler-Core/CompilationContext.class.st index 494ad3c75d7..a950d34c9ca 100644 --- a/src/OpalCompiler-Core/CompilationContext.class.st +++ b/src/OpalCompiler-Core/CompilationContext.class.st @@ -274,8 +274,6 @@ CompilationContext class >> optionReadOnlyLiterals [ { #category : #'options - settings API' } CompilationContext class >> optionReadOnlyLiterals: aBoolean [ - (aBoolean and: [ Smalltalk vm supportsWriteBarrier not]) ifTrue: [ ^ OCReadOnlyVMWarning signal ]. - ^ self writeDefaultOption: #optionReadOnlyLiterals value: aBoolean ] diff --git a/src/OpalCompiler-Core/OCReadOnlyVMWarning.class.st b/src/OpalCompiler-Core/OCReadOnlyVMWarning.class.st deleted file mode 100644 index 0da12e69f72..00000000000 --- a/src/OpalCompiler-Core/OCReadOnlyVMWarning.class.st +++ /dev/null @@ -1,33 +0,0 @@ -" -I get signalled when the compiler attempts to set a literal as read-only while the VM does not support read-only objects. -" -Class { - #name : #OCReadOnlyVMWarning, - #superclass : #OCSemanticWarning, - #category : #'OpalCompiler-Core-Exception' -} - -{ #category : #initialization } -OCReadOnlyVMWarning >> defaultAction [ - ^ self - resume: - (compilationContext interactive - ifTrue: [ OCSemanticError new - node: node; - compilationContext: compilationContext; - messageText: self messageText; - signal ] - ifFalse: [ SystemNotification signal: self messageText ]) -] - -{ #category : #initialization } -OCReadOnlyVMWarning >> initialize [ - - super initialize. - messageText := 'Bytecode compiler is trying to set a literal as read-only but the VM used does not support read-only objects'. -] - -{ #category : #correcting } -OCReadOnlyVMWarning >> openMenuIn: aBlock [ - self error: 'should not be called' -] diff --git a/src/OpalCompiler-Core/OCSemanticError.class.st b/src/OpalCompiler-Core/OCSemanticError.class.st index 089c298012d..74e8436935f 100644 --- a/src/OpalCompiler-Core/OCSemanticError.class.st +++ b/src/OpalCompiler-Core/OCSemanticError.class.st @@ -23,7 +23,7 @@ OCSemanticError >> compilationContext: anObject [ { #category : #exceptiondescription } OCSemanticError >> defaultAction [ - ^self notify: messageText at: node start. + ^self notify: messageText at: node start ] { #category : #accessing } @@ -48,17 +48,20 @@ OCSemanticError >> node: aNode [ { #category : #'error handling' } OCSemanticError >> notify: aString at: location [ - "Refer to the comment in Object|notify:." - - ^compilationContext requestor + ^self requestor ifNil: [SyntaxErrorNotification inClass: self methodClass withCode: self methodNode source doitFlag: false errorMessage: aString location: location] - ifNotNil: [compilationContext requestor + ifNotNil: [self requestor notify: aString , ' ->' at: location - in: compilationContext requestor text] + in: self requestor text] +] + +{ #category : #accessing } +OCSemanticError >> requestor [ + ^ compilationContext requestor ] diff --git a/src/OpalCompiler-Core/OCSemanticWarning.class.st b/src/OpalCompiler-Core/OCSemanticWarning.class.st index bf3635149fe..20588158788 100644 --- a/src/OpalCompiler-Core/OCSemanticWarning.class.st +++ b/src/OpalCompiler-Core/OCSemanticWarning.class.st @@ -67,23 +67,6 @@ OCSemanticWarning >> node: anObject [ node := anObject ] -{ #category : #correcting } -OCSemanticWarning >> notify: aString at: location [ - "Refer to the comment in Object|notify:." - - ^self requestor - ifNil: [SyntaxErrorNotification - inClass: self methodClass - withCode: self methodNode source - doitFlag: false - errorMessage: aString - location: location] - ifNotNil: [self requestor - notify: aString , ' ->' - at: location - in: self requestor text] -] - { #category : #correcting } OCSemanticWarning >> openMenuIn: aBlock [ self subclassResponsibility