eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'RBProgramNode':

Home

everywhere
www.exept.de
for:
[back]

Class: RBProgramNode


Inheritance:

   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

Description:


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


Class protocol:

accessing
o  formatterClass

o  formatterClass: aClass

o  optimizedSelectors

initialization
o  initialize


Instance protocol:

accessing
o  asReturn
Change the current node to a return node.

o  children

o  comments

o  comments: aCollection

o  commentsAfter

o  commentsAfter: aCollection

o  commentsBefore

o  commentsBefore: aCollection
commentsBefore notEmptyOrNil ifTrue:[self halt:'oops - loosing comments'].

o  formattedCode

o  formatterClass

o  lineNumber

o  lineNumber: something

o  originalCode

o  parent

o  parent: anObject

o  precedence

o  setCommentsAfter: aCollection

o  source

o  sourceInterval

o  start

** This method raises an error - it must be redefined in concrete classes **

o  stop

** This method raises an error - it must be redefined in concrete classes **

comparing
o  equalTo: aNode exceptForVariables: variableNameCollection

o  equalTo: aNode withMapping: aDictionary

copying
o  copy
This is redefined for IBM Smalltalk which doesn't have postCopy.

o  copyCommentsFrom: aNode
Add all comments from aNode to us. If we already have the comment, then don't add it.

o  postCopy

enumeration
o  collect: aBlock
Hacked to fit collection protocols

o  do: aBlock
Hacked to fit collection protocols

o  size
Hacked to fit collection protocols

iteration
o  nodesDo: aBlock

matching
o  copyInContext: aDictionary

o  copyList: matchNodes inContext: aDictionary

o  match: aNode inContext: aDictionary

o  matchList: matchNodes against: programNodes inContext: aDictionary

o  matchList: matchNodes index: matchIndex against: programNodes index: programIndex inContext: aDictionary

meta variable-accessing
o  cascadeListCharacter

o  ignoreInMatchCharacter

o  listCharacter

o  literalCharacter

o  recurseIntoCharacter

o  statementCharacter

printing
o  printOn: aStream

querying
o  bestNodeFor: anInterval

o  firstLineNumber

o  lastLineNumber
lineNumber isNil ifTrue:[self halt:'should always be non-nil'].

o  selfMessages

o  statementNode
Return your topmost node that is contained by a sequence node.

o  superMessages

replacing
o  removeDeadCode

o  replaceNode: aNode withNode: anotherNode

o  replaceWith: aNode

searching
o  whichNodeIntersects: anInterval

o  whichNodeIsContainedBy: anInterval

o  whoDefines: aName

special queries
o  addReferencedVariablesTo: aCollection

o  addUsedLiteralsTo: aCollection

o  addUsedSymbolsTo: aCollection

o  allArgumentVariables

o  allDefinedVariables

o  allTemporaryVariables

o  allVariablesOnScope

o  blockVariables

o  referencedVariables

o  sentMessages

o  temporaryVariables

o  usedLiterals

o  usedSymbols

testing
o  assigns: aVariableName

o  containedBy: anInterval

o  containsReturn

o  defines: aName

o  directlyUses: aNode

o  evaluatedFirst: aNode

o  intersectsInterval: anInterval

o  isAssignment

o  isBlock

o  isCascade

o  isChildOf: anotherNode

o  isDirectlyUsed
This node is directly used as an argument, receiver, or part of an assignment.

o  isEvaluatedFirst
Return true if we are the first thing evaluated in this statement.

o  isImmediate

o  isLast: aNode

o  isLiteral

o  isMessage

o  isMethod

o  isReturn

o  isSTXPrimitiveCCode

o  isSequence

o  isSqueakArray

o  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.

o  isValue

o  isVariable

o  lastIsReturn

o  references: aVariableName

o  uses: aNode

testing-matching
o  canMatchMethod: aCompiledMethod

o  isList

o  isPatternNode

o  recurseInto

visitor
o  acceptCommentsAfterVisitor: aVisitor

o  acceptCommentsBeforeVisitor: aVisitor

o  acceptVisitor: aProgramNodeVisitor

** This method raises an error - it must be redefined in concrete classes **



ST/X 6.1.1; WebServer 1.620 at exept:8081; Tue, 22 May 2012 21:52:38 GMT