Skip to content

Commit

Permalink
- comment Context>>#sourceNode
Browse files Browse the repository at this point in the history
- use #methodOrBlockNode, not #enclosingMethodOrBlockNode
  • Loading branch information
MarcusDenker committed Feb 18, 2020
1 parent 7599943 commit 95fee8c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/OpalCompiler-Core/Context.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,13 @@ Context >> isReturnAt: aPC [

{ #category : #'*OpalCompiler-Core' }
Context >> sourceNode [
"Return the source node of the method or the block of this context"
^ self sourceNodeExecuted enclosingMethodOrBlockNode
"Return the source node of the method or the block of this context.
Note: we can not just use the startPC to find the node as this ignores optimized blocks.
We instead get the executed PC and then go up to the sourceNode of the block or method.
For the topmost context, sourceNodeExecuted is off by one but that is not a problem as
we still end up getting the node we want (via the bytecode that created it)"

^ self sourceNodeExecuted methodOrBlockNode
]

{ #category : #'*OpalCompiler-Core' }
Expand Down

0 comments on commit 95fee8c

Please sign in to comment.