From 01ace3b35811c25c2be3e262a9e99863088c8d0e Mon Sep 17 00:00:00 2001 From: Marcus Denker Date: Thu, 2 Jul 2020 13:20:59 +0200 Subject: [PATCH] Dictionary had two methods related to Variables (scope lookup) - fix the Opal tests to use SystemDictionary - #outerscope is not needed - lookupVar: move to SystemDictionary --- src/OpalCompiler-Tests/OCASTTranslatorTest.class.st | 2 +- src/Slot-Core/Dictionary.extension.st | 13 ------------- src/Slot-Core/SystemDictionary.extension.st | 8 ++++++++ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/OpalCompiler-Tests/OCASTTranslatorTest.class.st b/src/OpalCompiler-Tests/OCASTTranslatorTest.class.st index 168cb2e0a95..955af51f628 100644 --- a/src/OpalCompiler-Tests/OCASTTranslatorTest.class.st +++ b/src/OpalCompiler-Tests/OCASTTranslatorTest.class.st @@ -153,7 +153,7 @@ OCASTTranslatorTest >> setUp [ super setUp. instance := OCOpalExamples new. - globals := Dictionary new. + globals := SystemDictionary new. ] { #category : #running } diff --git a/src/Slot-Core/Dictionary.extension.st b/src/Slot-Core/Dictionary.extension.st index e77803c71f2..f78cdc6bac4 100644 --- a/src/Slot-Core/Dictionary.extension.st +++ b/src/Slot-Core/Dictionary.extension.st @@ -23,16 +23,3 @@ Dictionary >> declareVariable: newGlobal from: aDictionary [ ifFalse: [ self add: newGlobal] ] - -{ #category : #'*Slot-Core' } -Dictionary >> lookupVar: name [ - "Return a var with this name. Return nil if none found" - name isString ifFalse: [ ^nil ]. - - ^self bindingOf: name -] - -{ #category : #'*Slot-Core' } -Dictionary >> outerScope [ - ^nil -] diff --git a/src/Slot-Core/SystemDictionary.extension.st b/src/Slot-Core/SystemDictionary.extension.st index fb8c74c8c2a..4b7851a524b 100644 --- a/src/Slot-Core/SystemDictionary.extension.st +++ b/src/Slot-Core/SystemDictionary.extension.st @@ -15,3 +15,11 @@ SystemDictionary >> declare: key from: aDictionary [ ifFalse: [self add: (GlobalVariable key: key)] ] + +{ #category : #'*Slot-Core' } +SystemDictionary >> lookupVar: name [ + "Return a var with this name. Return nil if none found" + name isString ifFalse: [ ^nil ]. + + ^self bindingOf: name +]