|
|
Class: RBProgramNode
Object
|
+--RBProgramNode
|
+--RBMethodNode
|
+--RBSequenceNode
|
+--RBStatementNode
- Package:
- stx:goodies/refactoryBrowser/parser
- Category:
- Refactory-AST-Nodes
- Version:
- rev:
1.39
date: 2009/10/16 09:55:44
- user: cg
- file: RBProgramNode.st directory: goodies/refactoryBrowser/parser
- module: stx stc-classLibrary: parser
BRProgramNode is an abstract class that represents an abstract syntax tree node in a Smalltalk program.
Subclasses must implement the following messages:
accessing
start
stop
visitor
acceptVisitor:
The #start and #stop methods are used to find the source that corresponds to this node. "source copyFrom: self start to: self stop" should return the source for this node.
The #acceptVisitor: method is used by BRProgramNodeVisitors (the visitor pattern). This will also require updating all the BRProgramNodeVisitors so that they know of the new node.
Subclasses might also want to redefine match:inContext: and copyInContext: to do parse tree searching and replacing.
Subclasses that contain other nodes should override equalTo:withMapping: to compare nodes while ignoring renaming temporary variables, and children that returns a collection of our children nodes.
Instance Variables:
comments <Collection of: Interval> the intervals in the source that have comments for this node
parent <BRProgramNode> the node we're contained in
accessing
-
formatterClass
-
-
formatterClass: aClass
-
-
optimizedSelectors
-
initialization
-
initialize
-
accessing
-
asReturn
-
Change the current node to a return node.
-
children
-
-
comments
-
-
comments: aCollection
-
-
commentsAfter
-
-
commentsAfter: aCollection
-
-
commentsBefore
-
-
commentsBefore: aCollection
-
commentsBefore notEmptyOrNil ifTrue:[self halt:'oops - loosing comments'].
-
formattedCode
-
-
formatterClass
-
-
lineNumber
-
-
lineNumber: something
-
-
originalCode
-
-
parent
-
-
parent: anObject
-
-
precedence
-
-
setCommentsAfter: aCollection
-
-
source
-
-
sourceInterval
-
-
start
-
** This method raises an error - it must be redefined in concrete classes **
-
stop
-
** This method raises an error - it must be redefined in concrete classes **
comparing
-
equalTo: aNode exceptForVariables: variableNameCollection
-
-
equalTo: aNode withMapping: aDictionary
-
copying
-
copy
-
This is redefined for IBM Smalltalk which doesn't have postCopy.
-
copyCommentsFrom: aNode
-
Add all comments from aNode to us. If we already have the comment, then don't add it.
-
postCopy
-
enumeration
-
collect: aBlock
-
Hacked to fit collection protocols
-
do: aBlock
-
Hacked to fit collection protocols
-
size
-
Hacked to fit collection protocols
iteration
-
nodesDo: aBlock
-
matching
-
copyInContext: aDictionary
-
-
copyList: matchNodes inContext: aDictionary
-
-
match: aNode inContext: aDictionary
-
-
matchList: matchNodes against: programNodes inContext: aDictionary
-
-
matchList: matchNodes index: matchIndex against: programNodes index: programIndex inContext: aDictionary
-
meta variable-accessing
-
cascadeListCharacter
-
-
ignoreInMatchCharacter
-
-
listCharacter
-
-
literalCharacter
-
-
recurseIntoCharacter
-
-
statementCharacter
-
printing
-
printOn: aStream
-
querying
-
bestNodeFor: anInterval
-
-
firstLineNumber
-
-
lastLineNumber
-
lineNumber isNil ifTrue:[self halt:'should always be non-nil'].
-
selfMessages
-
-
statementNode
-
Return your topmost node that is contained by a sequence node.
-
superMessages
-
replacing
-
removeDeadCode
-
-
replaceNode: aNode withNode: anotherNode
-
-
replaceWith: aNode
-
searching
-
whichNodeIntersects: anInterval
-
-
whichNodeIsContainedBy: anInterval
-
-
whoDefines: aName
-
special queries
-
addReferencedVariablesTo: aCollection
-
-
addUsedLiteralsTo: aCollection
-
-
addUsedSymbolsTo: aCollection
-
-
allArgumentVariables
-
-
allDefinedVariables
-
-
allTemporaryVariables
-
-
allVariablesOnScope
-
-
blockVariables
-
-
referencedVariables
-
-
sentMessages
-
-
temporaryVariables
-
-
usedLiterals
-
-
usedSymbols
-
testing
-
assigns: aVariableName
-
-
containedBy: anInterval
-
-
containsReturn
-
-
defines: aName
-
-
directlyUses: aNode
-
-
evaluatedFirst: aNode
-
-
intersectsInterval: anInterval
-
-
isAssignment
-
-
isBlock
-
-
isCascade
-
-
isChildOf: anotherNode
-
-
isDirectlyUsed
-
This node is directly used as an argument, receiver, or part of an assignment.
-
isEvaluatedFirst
-
Return true if we are the first thing evaluated in this statement.
-
isImmediate
-
-
isLast: aNode
-
-
isLiteral
-
-
isMessage
-
-
isMethod
-
-
isReturn
-
-
isSTXPrimitiveCCode
-
-
isSequence
-
-
isSqueakArray
-
-
isUsed
-
Answer true if this node could be used as part of another expression. For example, you could use the
result of this node as a receiver of a message, an argument, the right part of an assignment, or the
return value of a block. This differs from isDirectlyUsed in that it is conservative since it also includes
return values of blocks.
-
isValue
-
-
isVariable
-
-
lastIsReturn
-
-
references: aVariableName
-
-
uses: aNode
-
testing-matching
-
canMatchMethod: aCompiledMethod
-
-
isList
-
-
isPatternNode
-
-
recurseInto
-
visitor
-
acceptCommentsAfterVisitor: aVisitor
-
-
acceptCommentsBeforeVisitor: aVisitor
-
-
acceptVisitor: aProgramNodeVisitor
-
** This method raises an error - it must be redefined in concrete classes **
|