Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #4853 from MarcusDenker/Opal-remove-variableNamed
Browse files Browse the repository at this point in the history
Opal: remove #variableNamed:
  • Loading branch information
MarcusDenker committed Oct 7, 2019
2 parents 1b3dd9a + ef8be2b commit f89b546
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 64 deletions.
10 changes: 0 additions & 10 deletions src/OpalCompiler-Core/OCAbstractMethodScope.class.st
Expand Up @@ -286,13 +286,3 @@ OCAbstractMethodScope >> tempVectorName [
This way we avoid name clashes "
^'0vector', id asString
]

{ #category : #lookup }
OCAbstractMethodScope >> variableNamed: name ifAbsent: aBlock [
copiedVars at: name ifPresent: [:v | ^ v].
tempVector at: name ifPresent: [:v | ^ v].
tempVars at: name ifPresent: [:v | ^ v].
name = 'thisContext' ifTrue: [^ thisContextVar].

^ aBlock value.
]
6 changes: 0 additions & 6 deletions src/OpalCompiler-Core/OCAbstractScope.class.st
Expand Up @@ -111,9 +111,3 @@ OCAbstractScope >> scopeLevel [
outerScope ifNil: [^ 0].
^ outerScope scopeLevel + 1
]

{ #category : #accessing }
OCAbstractScope >> variableNamed: aName [

^ self variableNamed: aName ifAbsent: [ nil ]
]
11 changes: 0 additions & 11 deletions src/OpalCompiler-Core/OCClassScope.class.st
Expand Up @@ -75,14 +75,3 @@ OCClassScope >> printOn: stream [

class printOn: stream.
]

{ #category : #lookup }
OCClassScope >> variableNamed: name ifAbsent: aBlock [
"Return a SemVar for my pool var with this name. Return nil if none found"

^(class bindingOf: name asSymbol) ifNotNil: [:assoc |
OCLiteralVariable new
assoc: assoc;
scope: self;
yourself] ifNil: aBlock
]
15 changes: 0 additions & 15 deletions src/OpalCompiler-Core/OCExtraBindingScope.class.st
Expand Up @@ -59,18 +59,3 @@ OCExtraBindingScope >> newMethodScope [

^ OCMethodScope new outerScope: (self outerScope: outerScope instanceScope)
]

{ #category : #'instance creation' }
OCExtraBindingScope >> variableNamed: name ifAbsent: aBlock [

name = 'self' ifTrue: [ ^outerScope lookupVar: name].
name = 'super' ifTrue: [ ^outerScope lookupVar: name].
name first isUppercase ifTrue: [ | found |
found := outerScope lookupVar: name.
found ifNotNil: [ ^found ]].

(bindings bindingOf: name asSymbol) ifNotNil: [:assoc |
^ OCLiteralVariable new assoc: assoc; scope: self; yourself].

^ aBlock value
]
9 changes: 0 additions & 9 deletions src/OpalCompiler-Core/OCInstanceScope.class.st
Expand Up @@ -85,12 +85,3 @@ OCInstanceScope >> slots: slotCollection [
yourself)].

]

{ #category : #lookup }
OCInstanceScope >> variableNamed: name ifAbsent: aBlock [
"Return a ScopeVar for my inst var with this name. Return nil if none found"

name = 'self' ifTrue: [^ selfVar].
name = 'super' ifTrue: [^ superVar].
^ vars at: name ifAbsent: aBlock
]
13 changes: 0 additions & 13 deletions src/OpalCompiler-Core/OCRequestorScope.class.st
Expand Up @@ -82,16 +82,3 @@ OCRequestorScope >> requestor [
OCRequestorScope >> requestor: anObject [
requestor := anObject
]

{ #category : #lookup }
OCRequestorScope >> variableNamed: name ifAbsent: aBlock [

name = 'self' ifTrue: [ ^outerScope lookupVar: name].
name = 'super' ifTrue: [ ^outerScope lookupVar: name].
name first isUppercase ifTrue: [ ^outerScope lookupVar: name ].

(requestor bindingOf: name asSymbol) ifNotNil: [:assoc |
^ OCLiteralVariable new assoc: assoc; scope: self; yourself].

^ aBlock value
]

0 comments on commit f89b546

Please sign in to comment.