Skip to content

Commit

Permalink
Merge pull request #19 from pharo-contributions/fix-metarecursion
Browse files Browse the repository at this point in the history
Fixed metaRecursion for borderline cases
  • Loading branch information
jordanmontt committed Jul 16, 2024
2 parents 4627ba2 + fe6db35 commit bb8911d
Show file tree
Hide file tree
Showing 17 changed files with 246 additions and 1,299 deletions.
20 changes: 11 additions & 9 deletions src/MethodProxies-Tests/MpAbstractMethodProxyTest.class.st
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
Class {
#name : #MpAbstractMethodProxyTest,
#superclass : #TestCase,
#name : 'MpAbstractMethodProxyTest',
#superclass : 'TestCase',
#instVars : [
'trackedWrappers'
],
#category : #'MethodProxies-Tests'
#category : 'MethodProxies-Tests',
#package : 'MethodProxies-Tests'
}

{ #category : #testing }
{ #category : 'testing' }
MpAbstractMethodProxyTest class >> isAbstract [

^ self == MpAbstractMethodProxyTest
]

{ #category : #'tests - dead representation' }
{ #category : 'tests - dead representation' }
MpAbstractMethodProxyTest >> installMethodProxy: aMethodProxy [

trackedWrappers add: aMethodProxy.
aMethodProxy install.

aMethodProxy
install;
enableInstrumentation
]

{ #category : #initialization }
{ #category : 'initialization' }
MpAbstractMethodProxyTest >> setUp [

super setUp.
trackedWrappers := OrderedCollection new
]

{ #category : #initialization }
{ #category : 'initialization' }
MpAbstractMethodProxyTest >> tearDown [

| stillInstalled |
Expand Down
13 changes: 7 additions & 6 deletions src/MethodProxies-Tests/MpAfterCounterHandler.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,27 @@ I am a method proxy handler for testing that increments a counter after the meth
I therefore test method exit
"
Class {
#name : #MpAfterCounterHandler,
#superclass : #MpHandler,
#name : 'MpAfterCounterHandler',
#superclass : 'MpHandler',
#instVars : [
'count'
],
#category : #'MethodProxies-Tests'
#category : 'MethodProxies-Tests',
#package : 'MethodProxies-Tests'
}

{ #category : #evaluating }
{ #category : 'evaluating' }
MpAfterCounterHandler >> afterMethod [

count := count + 1
]

{ #category : #accessing }
{ #category : 'accessing' }
MpAfterCounterHandler >> count [
^ count
]

{ #category : #evaluating }
{ #category : 'evaluating' }
MpAfterCounterHandler >> initialize [

super initialize.
Expand Down
13 changes: 7 additions & 6 deletions src/MethodProxies-Tests/MpAfterResultHandler.class.st
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
Class {
#name : #MpAfterResultHandler,
#superclass : #MpHandler,
#name : 'MpAfterResultHandler',
#superclass : 'MpHandler',
#instVars : [
'count'
],
#category : #'MethodProxies-Tests'
#category : 'MethodProxies-Tests',
#package : 'MethodProxies-Tests'
}

{ #category : #evaluating }
{ #category : 'evaluating' }
MpAfterResultHandler >> afterExecutionWithReceiver: anObject arguments: anArrayOfObjects returnValue: aReturnValue [

^ 'trapped [', aReturnValue asString, ']'
]

{ #category : #accessing }
{ #category : 'accessing' }
MpAfterResultHandler >> count [
^ count
]

{ #category : #evaluating }
{ #category : 'evaluating' }
MpAfterResultHandler >> initialize [

super initialize.
Expand Down
29 changes: 15 additions & 14 deletions src/MethodProxies-Tests/MpClassA.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,76 +3,77 @@ Instance Variables:
x <Integer>
"
Class {
#name : #MpClassA,
#superclass : #Object,
#name : 'MpClassA',
#superclass : 'Object',
#instVars : [
'x'
],
#category : #'MethodProxies-Tests'
#category : 'MethodProxies-Tests',
#package : 'MethodProxies-Tests'
}

{ #category : #accessing }
{ #category : 'accessing' }
MpClassA >> methodAcceptingABlock: aBlock [

^ aBlock value
]

{ #category : #debugging }
{ #category : 'debugging' }
MpClassA >> methodDelay [

(Delay forMilliseconds: 1) wait.
]

{ #category : #debugging }
{ #category : 'debugging' }
MpClassA >> methodLastingOneSecond [

(Delay forMilliseconds: 0.5) wait.
^ 999
]

{ #category : #debugging }
{ #category : 'debugging' }
MpClassA >> methodOne [

^ 101
]

{ #category : #debugging }
{ #category : 'debugging' }
MpClassA >> methodTwo [
^ 42
]

{ #category : #debugging }
{ #category : 'debugging' }
MpClassA >> methodWithArgument: anInteger [

self x: self x + anInteger.
^ self x
]

{ #category : #debugging }
{ #category : 'debugging' }
MpClassA >> methodWithException [

1/0
]

{ #category : #accessing }
{ #category : 'accessing' }
MpClassA >> methodWithNonLocalReturn [

self methodAcceptingABlock: [ ^ self ]
]

{ #category : #debugging }
{ #category : 'debugging' }
MpClassA >> methodWithWarning [

Warning new signal: 'I warned you'.
]

{ #category : #accessing }
{ #category : 'accessing' }
MpClassA >> x [

^ x
]

{ #category : #accessing }
{ #category : 'accessing' }
MpClassA >> x: anInteger [

x := anInteger
Expand Down
11 changes: 6 additions & 5 deletions src/MethodProxies-Tests/MpClassB.class.st
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
Class {
#name : #MpClassB,
#superclass : #MpClassA,
#category : #'MethodProxies-Tests'
#name : 'MpClassB',
#superclass : 'MpClassA',
#category : 'MethodProxies-Tests',
#package : 'MethodProxies-Tests'
}

{ #category : #debugging }
{ #category : 'debugging' }
MpClassB >> methodThree [

^ 789
]

{ #category : #debugging }
{ #category : 'debugging' }
MpClassB >> methodTwo [

^ 84
Expand Down
Loading

0 comments on commit bb8911d

Please sign in to comment.