Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing a test that was failing the first time it was executed, because it didn't set a class variable before testing its value #34

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
8 changes: 8 additions & 0 deletions DebuggableASTInterpreter/DASTInterpreter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,14 @@ DASTInterpreter >> visitLiteralVariableNode: aRBVariableNode [
^ self visitGlobalNode: aRBVariableNode
]

{ #category : #visiting }
DASTInterpreter >> visitLocalVariableNode: aNode [

"call visitTemporaryNode: for backward compatibility"

^ self visitTemporaryNode: aNode
]

{ #category : #visiting }
DASTInterpreter >> visitMessageNode: aRBMessageNode [
| arguments receiver method newContext |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ DASTInterpreterClassForTests3 >> initialize [
DASTInterpreterClassForTests3 >> setClassVariable [
classVar := 42
]

{ #category : #initialization }
DASTInterpreterClassForTests3 >> setClassVariableToNil [
classVar := nil
]
17 changes: 12 additions & 5 deletions DebuggableASTInterpreter/DASTInterpreterTests.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,13 @@ DASTInterpreterTests >> testFalse [

{ #category : #'tests-variables-class' }
DASTInterpreterTests >> testGetClassVariableFromMethodInInstanceSide [
self assert: (self evaluateProgram: 'DASTInterpreterClassForTests3 new getClassVariable' )
equals: 42

| value |
value := DASTInterpreterClassForTests3 new getClassVariable.
self
assert: (self evaluateProgram:
'DASTInterpreterClassForTests3 new getClassVariable')
equals: value


]
Expand Down Expand Up @@ -773,10 +778,12 @@ DASTInterpreterTests >> testSendMessageToBlock [
{ #category : #'tests-variables-class' }
DASTInterpreterTests >> testSetAndGetClassVariableFromMethodInInstanceSide [
"ToDo: reimplement when the environment contains representation of objects"
self assert: (self evaluateProgram: 'DASTInterpreterClassForTests3 new setClassVariable. DASTInterpreterClassForTests3 new getClassVariable' )
equals: 42


DASTInterpreterClassForTests3 new setClassVariableToNil.
self
assert: (self evaluateProgram:
'DASTInterpreterClassForTests3 new setClassVariable. DASTInterpreterClassForTests3 new getClassVariable')
equals: 42
]

{ #category : #'tests-variables-class' }
Expand Down
12 changes: 10 additions & 2 deletions DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ DASTPostOrderTreeVisitor >> visitArgumentNode: aRBArgumentNode [
]

{ #category : #visiting }
DASTPostOrderTreeVisitor >> visitArgumentVariableNode: aRBVariableNode [
DASTPostOrderTreeVisitor >> visitArgumentVariableNode: aRBVariableNode [

^ self visitTemporaryNode: aRBVariableNode
]
Expand Down Expand Up @@ -113,6 +113,14 @@ DASTPostOrderTreeVisitor >> visitLiteralVariableNode: aRBVariableNode [
^ self visitGlobalNode: aRBVariableNode
]

{ #category : #visiting }
DASTPostOrderTreeVisitor >> visitLocalVariableNode: aNode [

"call visitTemporaryNode: for backward compatibility"

^ self visitTemporaryNode: aNode
]

{ #category : #visiting }
DASTPostOrderTreeVisitor >> visitMessageNode: aRBMessageNode [

Expand Down Expand Up @@ -157,7 +165,7 @@ DASTPostOrderTreeVisitor >> visitSuperNode: aRBSuperNode [
^ stack push: aRBSuperNode
]

{ #category : #'as yet unclassified' }
{ #category : #visiting }
DASTPostOrderTreeVisitor >> visitTemporaryNode: aRBTemporaryNode [
stack push: aRBTemporaryNode
]
Expand Down