Skip to content

Commit

Permalink
Merge pull request pharo-project#8629 from MarcusDenker/Decompiler-te…
Browse files Browse the repository at this point in the history
…st-and-fix-super-inBlock-classSide

Decompiler-test-and-fix-super-inBlock-classSide
  • Loading branch information
Ducasse committed Feb 28, 2021
2 parents c83a9d6 + 95ba88a commit f29736f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
18 changes: 18 additions & 0 deletions src/Flashback-Decompiler-Tests/FBDDecompilerTest.class.st
Expand Up @@ -13,6 +13,12 @@ FBDDecompilerTest >> checkCorrectDecompilation: aSelector [
self checkCorrectMethodDecompilation: (self getMethod: aSelector)
]

{ #category : #verification }
FBDDecompilerTest >> checkCorrectDecompilationClassSide: aSelector [

self checkCorrectMethodDecompilation: (self getMethodClassSide: aSelector)
]

{ #category : #verification }
FBDDecompilerTest >> checkCorrectMethodDecompilation: originalMethod [

Expand Down Expand Up @@ -66,6 +72,12 @@ FBDDecompilerTest >> getMethod: selector [
^ self exampleClass >> selector
]

{ #category : #private }
FBDDecompilerTest >> getMethodClassSide: selector [

^ self exampleClass class >> selector
]

{ #category : #tests }
FBDDecompilerTest >> test2Loops [

Expand Down Expand Up @@ -806,6 +818,12 @@ FBDDecompilerTest >> testSuperCallInBlock [
self checkCorrectDecompilation: #superCallInBlock
]

{ #category : #tests }
FBDDecompilerTest >> testSuperCallInBlockClassSide [

self checkCorrectDecompilationClassSide: #superCallInBlock
]

{ #category : #tests }
FBDDecompilerTest >> testThisContext [

Expand Down
7 changes: 7 additions & 0 deletions src/Flashback-Decompiler-Tests/FBDExamples.class.st
Expand Up @@ -14,6 +14,13 @@ Class {
#category : #'Flashback-Decompiler-Tests-Examples'
}

{ #category : #examples }
FBDExamples class >> superCallInBlock [

^ [ super yourself ] value

]

{ #category : #examples }
FBDExamples >> doubleRemoteAnidatedBlocks [

Expand Down
7 changes: 5 additions & 2 deletions src/Flashback-Decompiler/FBDASTBuilder.class.st
Expand Up @@ -20,8 +20,11 @@ FBDASTBuilder class >> newFor: class [
]

{ #category : #constructor }
FBDASTBuilder >> codeAnyLitInd: anAssociation [
^ (RBVariableNode named: anAssociation key)
FBDASTBuilder >> codeAnyLitInd: anAssociation [
| varName |
"class binding on the class side has nil as key"
varName := anAssociation key ifNil: [ 'class binding' ] ifNotNil: [ anAssociation key ].
^ (RBVariableNode named: varName)
binding: anAssociation;
yourself
]
Expand Down

0 comments on commit f29736f

Please sign in to comment.