Skip to content

Commit

Permalink
Cleanup: do not use #notNil, use #isNotNil instead
Browse files Browse the repository at this point in the history
Fix #95
  • Loading branch information
astares committed May 16, 2024
1 parent d0304a2 commit 18b9e5b
Show file tree
Hide file tree
Showing 26 changed files with 210 additions and 189 deletions.
2 changes: 1 addition & 1 deletion src/Sindarin-Tests/SindarinDebugSessionTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ SindarinDebugSessionTest >> testSindarinSessionInstantiation [
sindarinSession := SindarinDebugSession
newWithName: sessionName
forProcess: process.
self assert: sindarinSession debugSession notNil.
self assert: sindarinSession debugSession isNotNil.
self assert: sindarinSession debugSession name equals: sessionName.
self
assert: sindarinSession debugSession process
Expand Down
7 changes: 3 additions & 4 deletions src/Sindarin-Tests/SindarinDebuggerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ SindarinDebuggerTest >> methodWithNotEvaluatedBlockWhoseCreationIsFirstBytecodeI
^ a * 42
]


{ #category : 'helpers' }
SindarinDebuggerTest >> methodWithOneAssignment [

Expand Down Expand Up @@ -1399,7 +1398,7 @@ SindarinDebuggerTest >> testSkipCanSkipReturnIfItIsNotTheLastReturn [
self assert: scdbg node value value equals: 2
]

{ #category : #tests }
{ #category : 'tests' }
SindarinDebuggerTest >> testSkipCannotSkipReturnIfItIsTheLastReturn [

| scdbg nodeWithImplicitReturn |
Expand Down Expand Up @@ -2041,8 +2040,8 @@ SindarinDebuggerTest >> testTemporaryNamed [
SindarinDebuggerTest >> testTerminate [
| dbg |
dbg := SindarinDebugger debug: [ self helperMethod13 ].
self assert: dbg debugSession interruptedContext notNil.
self assert: dbg debugSession interruptedProcess notNil.
self assert: dbg debugSession interruptedContext isNotNil.
self assert: dbg debugSession interruptedProcess isNotNil.
dbg terminate.
self assert: dbg debugSession interruptedContext isNil.
self assert: dbg debugSession interruptedProcess isNil.
Expand Down
4 changes: 2 additions & 2 deletions src/Sindarin/Context.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #Context }
Extension { #name : 'Context' }

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
Context >> stepToSendOrReturnOrJump [

"Simulate the execution of bytecodes until either sending a message or
Expand Down
8 changes: 4 additions & 4 deletions src/Sindarin/DebugSession.extension.st
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Extension { #name : #DebugSession }
Extension { #name : 'DebugSession' }

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
DebugSession >> asSindarinDebugSession [
^ SindarinDebugSession new debugSession: self
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
DebugSession >> stepToFirstInterestingBytecodeWithJumpIn: aProcess [
"After a restart of a method activation step to the first
bytecode instruction that is of interest for the debugger.
Expand All @@ -24,7 +24,7 @@ DebugSession >> stepToFirstInterestingBytecodeWithJumpIn: aProcess [
^ aProcess stepToSendOrReturnOrJump
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
DebugSession >> suspendedContext: aContext [

interruptedContext := aContext
Expand Down
10 changes: 6 additions & 4 deletions src/Sindarin/DebuggedExecutionException.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Class {
#name : #DebuggedExecutionException,
#superclass : #Error,
#category : #'Sindarin-Exceptions'
#name : 'DebuggedExecutionException',
#superclass : 'Error',
#category : 'Sindarin-Exceptions',
#package : 'Sindarin',
#tag : 'Exceptions'
}

{ #category : #testing }
{ #category : 'testing' }
DebuggedExecutionException >> isExceptionSignalledForDebuggedExecution [
^ true
]
8 changes: 5 additions & 3 deletions src/Sindarin/DebuggedExecutionIsFinished.class.st
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Class {
#name : #DebuggedExecutionIsFinished,
#superclass : #DebuggedExecutionException,
#category : #'Sindarin-Exceptions'
#name : 'DebuggedExecutionIsFinished',
#superclass : 'DebuggedExecutionException',
#category : 'Sindarin-Exceptions',
#package : 'Sindarin',
#tag : 'Exceptions'
}
12 changes: 6 additions & 6 deletions src/Sindarin/InstructionStream.extension.st
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
Extension { #name : #InstructionStream }
Extension { #name : 'InstructionStream' }

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
InstructionStream >> willJump [
"Answer whether the next bytecode will jump."

^ self willJumpIfFalse or:[ self willJumpIfTrue or: [ self willJumpTo ] ]
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
InstructionStream >> willJumpIfTrue [
"Answer whether the next bytecode is a jump-if-false."

^ self method encoderClass isBranchIfTrueAt: pc in: self method
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
InstructionStream >> willJumpTo [
"Answer whether the next bytecode is a jump-if-false."

^ self method encoderClass isJumpAt: pc in: self method
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
InstructionStream >> willSendOrReturnOrStoreOrCreateBlock [

"Answer whether the next bytecode will be interesting for the debugger to stop."
Expand All @@ -30,7 +30,7 @@ InstructionStream >> willSendOrReturnOrStoreOrCreateBlock [
self willReturn or: [ self willStore or: [ self willCreateBlock ] ] ]
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
InstructionStream >> willStoreButNotPop [
"Answer whether the next bytecode is a store that are not store-pop"

Expand Down
8 changes: 5 additions & 3 deletions src/Sindarin/NodeNotInASTError.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
I am signaled when we try to move the execution to a node that is not in the home context's method ast.
"
Class {
#name : #NodeNotInASTError,
#superclass : #Error,
#category : #'Sindarin-Exceptions'
#name : 'NodeNotInASTError',
#superclass : 'Error',
#category : 'Sindarin-Exceptions',
#package : 'Sindarin',
#tag : 'Exceptions'
}
8 changes: 5 additions & 3 deletions src/Sindarin/NotValidPcError.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
I am signaled when I try to modify the execution of a context to get to an invalid PC (lower than the method initalPC or greater than the method endPC)
"
Class {
#name : #NotValidPcError,
#superclass : #Error,
#category : #'Sindarin-Exceptions'
#name : 'NotValidPcError',
#superclass : 'Error',
#category : 'Sindarin-Exceptions',
#package : 'Sindarin',
#tag : 'Exceptions'
}
4 changes: 2 additions & 2 deletions src/Sindarin/OCBytecodeToASTCache.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #OCBytecodeToASTCache }
Extension { #name : 'OCBytecodeToASTCache' }

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
OCBytecodeToASTCache >> firstRecursiveBcOffsetForStatementNode: aStatementNode [

^ self methodOrBlockNode bcToASTCache bcToASTMap keys sorted detect: [
Expand Down
4 changes: 2 additions & 2 deletions src/Sindarin/Object.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #Object }
Extension { #name : 'Object' }

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
Object >> isExceptionSignalledForDebuggedExecution [
^ false
]
4 changes: 2 additions & 2 deletions src/Sindarin/Process.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #Process }
Extension { #name : 'Process' }

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
Process >> stepToSendOrReturnOrJump [

^Processor activeProcess
Expand Down
4 changes: 2 additions & 2 deletions src/Sindarin/RBAssignmentNode.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #RBAssignmentNode }
Extension { #name : 'RBAssignmentNode' }

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBAssignmentNode >> skipWithDebugger: aSindarinDebugger [

aSindarinDebugger skipAssignmentNodeCompletely
Expand Down
18 changes: 10 additions & 8 deletions src/Sindarin/RBBlockDefinitionSearchingVisitor.class.st
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
Class {
#name : #RBBlockDefinitionSearchingVisitor,
#superclass : #RBProgramNodeVisitor,
#name : 'RBBlockDefinitionSearchingVisitor',
#superclass : 'RBProgramNodeVisitor',
#instVars : [
'blockToSearch',
'isBlockFound'
],
#category : #'Sindarin-Base'
#category : 'Sindarin-Base',
#package : 'Sindarin',
#tag : 'Base'
}

{ #category : #'instance creation' }
{ #category : 'instance creation' }
RBBlockDefinitionSearchingVisitor class >> newToSearch: aBlockNode [

^ self new
blockToSearch: aBlockNode;
yourself
]

{ #category : #accessing }
{ #category : 'accessing' }
RBBlockDefinitionSearchingVisitor >> blockToSearch: aBlockNode [

blockToSearch := aBlockNode.
isBlockFound := false
]

{ #category : #initialization }
{ #category : 'initialization' }
RBBlockDefinitionSearchingVisitor >> initialize [

isBlockFound := false
]

{ #category : #accessing }
{ #category : 'accessing' }
RBBlockDefinitionSearchingVisitor >> isBlockFound [

^ isBlockFound
]

{ #category : #visiting }
{ #category : 'visiting' }
RBBlockDefinitionSearchingVisitor >> visitNode: aNode [

super visitNode: aNode.
Expand Down
12 changes: 6 additions & 6 deletions src/Sindarin/RBBlockNode.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #RBBlockNode }
Extension { #name : 'RBBlockNode' }

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBBlockNode >> executedNodesAfter: aNode [

"Gives all nodes that are executed after aNode. Assuming that aNode is a recursive child, then all nodes executed after it are all nodes after it in allChildrenPostOrder"
Expand All @@ -13,13 +13,13 @@ RBBlockNode >> executedNodesAfter: aNode [
^ nodesAfter
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBBlockNode >> firstPCOfStatement: aStatementNode [

^ self bcToASTCache firstRecursiveBcOffsetForStatementNode: aStatementNode
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBBlockNode >> nextExecutedNodeAfter: aNode [

"Find first node that is after aNode that has an associated pc in method node all children (post-order)"
Expand All @@ -31,7 +31,7 @@ RBBlockNode >> nextExecutedNodeAfter: aNode [
^ nodesAfter at: indexOfNextNode
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBBlockNode >> parentOfIdenticalSubtree: subtree [

^ self allChildren reversed
Expand All @@ -40,7 +40,7 @@ RBBlockNode >> parentOfIdenticalSubtree: subtree [
ifNone: [ nil ]
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBBlockNode >> skipWithDebugger: aSindarinDebugger [

aSindarinDebugger skipBlockNode
Expand Down
4 changes: 2 additions & 2 deletions src/Sindarin/RBMessageNode.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #RBMessageNode }
Extension { #name : 'RBMessageNode' }

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBMessageNode >> skipWithDebugger: aSindarinDebugger [

aSindarinDebugger skipMessageNode
Expand Down
12 changes: 6 additions & 6 deletions src/Sindarin/RBMethodNode.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #RBMethodNode }
Extension { #name : 'RBMethodNode' }

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBMethodNode >> executedNodesAfter: aNode [

"Gives all nodes that are executed after aNode. Assuming that aNode is a recursive child, then all nodes executed after it are all nodes after it in allChildrenPostOrder"
Expand All @@ -13,13 +13,13 @@ RBMethodNode >> executedNodesAfter: aNode [
^ nodesAfter
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBMethodNode >> firstPCOfStatement: aStatementNode [

^ self bcToASTCache firstRecursiveBcOffsetForStatementNode: aStatementNode
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBMethodNode >> nextExecutedNodeAfter: aNode [

"Find first node that is after aNode that has an associated pc in method node all children (post-order)"
Expand All @@ -31,7 +31,7 @@ RBMethodNode >> nextExecutedNodeAfter: aNode [
^ nodesAfter at: indexOfNextNode
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBMethodNode >> parentOfIdenticalSubtree: subtree [

^ self allChildren reversed
Expand All @@ -40,7 +40,7 @@ RBMethodNode >> parentOfIdenticalSubtree: subtree [
ifNone: [ nil ]
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBMethodNode >> statementNodeContaining: aNode [

| statementNode parentOfStatementNode |
Expand Down
6 changes: 3 additions & 3 deletions src/Sindarin/RBProgramNode.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #RBProgramNode }
Extension { #name : 'RBProgramNode' }

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBProgramNode >> allChildrenPostOrder [

| children |
Expand All @@ -11,7 +11,7 @@ RBProgramNode >> allChildrenPostOrder [
^ children
]

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBProgramNode >> skipWithDebugger: aSindarinDebugger [

aSindarinDebugger step
Expand Down
4 changes: 2 additions & 2 deletions src/Sindarin/RBReturnNode.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #RBReturnNode }
Extension { #name : 'RBReturnNode' }

{ #category : #'*Sindarin' }
{ #category : '*Sindarin' }
RBReturnNode >> skipWithDebugger: aSindarinDebugger [

aSindarinDebugger skipReturnNode
Expand Down
Loading

0 comments on commit 18b9e5b

Please sign in to comment.