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

updating ASTInterpreter and ASTPostOrderTreeVisitor according to new AST visitor API #1

Merged
merged 1 commit into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions DebuggableASTInterpreter/DASTInterpreter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,25 @@ DASTInterpreter >> visitCascadeNode: aRBCascadeNode [
self flag: 'I do nothing'.
]

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

^ self visitLiteralVariableNode: aNode
]

{ #category : #visiting }
DASTInterpreter >> visitGlobalNode: aRBGlobalNode [

self stackPush: (currentContext findVariable: aRBGlobalNode name)

]

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

^ self visitLiteralVariableNode: aNode
]

{ #category : #visiting }
DASTInterpreter >> visitInstanceVariableNode: aRBInstanceVariableNode [
self stackPush: (self readInstanceVariableNamed: aRBInstanceVariableNode name)
Expand All @@ -379,6 +391,21 @@ DASTInterpreter >> visitLiteralValueNode: aRBLiteralValueNode [
self visitLiteralNode: aRBLiteralValueNode
]

{ #category : #visiting }
DASTInterpreter >> visitLiteralVariableNode: aNode [
"to be backward compatible, we visit for Gloabls here (there used to be no difference)"

^ self visitGlobalNode: aNode
]

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

"call visitTemporaryNode: for backward compatibility"

^ self visitTemporaryNode: aNode
]

{ #category : #visiting }
DASTInterpreter >> visitMessageNode: aRBMessageNode [
| arguments receiver method newContext |
Expand Down
29 changes: 28 additions & 1 deletion DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,23 @@ DASTPostOrderTreeVisitor >> visitCascadeNode: aRBCascadeNode [
aRBCascadeNode children reverse do: [ :e | e acceptVisitor: self ]
]

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

^ self visitLiteralVariableNode: aNode
]

{ #category : #visiting }
DASTPostOrderTreeVisitor >> visitGlobalNode: aRBGlobalNode [
stack push: aRBGlobalNode
]

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

^ self visitLiteralVariableNode: aNode
]

{ #category : #visiting }
DASTPostOrderTreeVisitor >> visitInstanceVariableNode: aRBInstanceVariableNode [
stack push: aRBInstanceVariableNode
Expand All @@ -95,6 +107,21 @@ DASTPostOrderTreeVisitor >> visitLiteralValueNode: aRBLiteralValueNode [
^ self visitLiteralNode: aRBLiteralValueNode
]

{ #category : #visiting }
DASTPostOrderTreeVisitor >> visitLiteralVariableNode: aNode [
"to be backward compatible, we visit for Gloabls here (there used to be no difference)"

^ self visitGlobalNode: aNode
]

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

"call visitTemporaryNode: for backward compatibility"

^ self visitTemporaryNode: aNode
]

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

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

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