|
Class: VariableNode
Object
|
+--ParseNode
|
+--PrimaryNode
|
+--VariableNode
|
+--JavaScriptVariableNode
- Package:
- stx:libcomp
- Category:
- System-Compiler-Support
- Version:
- rev:
1.111
date: 2019/07/31 23:45:19
- user: cg
- file: VariableNode.st directory: libcomp
- module: stx stc-classLibrary: libcomp
- Author:
- Claus Gittinger
node for parse-trees, representing variables
This is a helper class for the compiler.
instance creation
-
blockArgumentNamed: n
-
-
globalNamed: n
-
because this is called even for invalid (partial) names,
and we do not want to create zillions of unused symbols,
no asSymbol is done here. So the name kept is actually a string.
A symbol will be created when code is actually created for it
-
methodArgumentNamed: n
-
-
methodLocalNamed: n
-
-
type: t class: class name: n
-
-
type: t context: aContext
-
-
type: t holder: holder name: n
-
-
type: t name: n
-
-
type: t name: n context: aContext index: i
-
-
type: t name: n index: i selfClass: s
-
-
type: t name: n index: i selfValue: s
-
-
type: t name: n token: tok index: i
-
-
type: t name: n token: tok index: i block: b from: codeBlock
-
accessing
-
block
-
-
block: something
-
-
index
-
-
index: anIntegerIndex
-
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).
-
name
-
-
name: something
-
-
token
-
-
token: something
-
-
type
-
-
type: t class: class name: n
-
type == #PoolVariable ifTrue:[self breakPoint:#cg].
-
type: t context: aContext
-
-
type: t holder: holder name: n
-
-
type: t name: n
-
-
type: t name: n context: aContext index: anIntegerIndex
-
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).
-
type: t name: n index: anIntegerIndex selfClass: s
-
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).
-
type: t name: n index: anIntegerIndex selfValue: s
-
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).
-
type: t name: n token: tok index: anIntegerIndex
-
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).
-
type: t name: n token: tok index: anIntegerIndex block: variableBlock from: codeBlock
-
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).
-
type: t token: tok index: anIntegerIndex block: b
-
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).
code generation
-
codeForSideEffectOn: aStream inBlock: b for: aCompiler
-
no code at all
-
codeForSimpleReturnOn: aStream inBlock: b lineNumber: lineNrOrNil for: aCompiler
-
anything else must be pushed, then top returned
-
codeLoadOn: aStream type: type index: index inBlock: codeBlock for: aCompiler
-
compiling for codeBlock; accessing variable in block.
-
codeOn: aStream inBlock: codeBlock for: aCompiler
-
-
codeStoreOn: aStream inBlock: codeBlock valueNeeded: valueNeeded for: aCompiler
-
-
codeStoreOn: aStream type: type index: index inBlock: codeBlock valueNeeded: valueNeeded for: aCompiler
-
value to be stored is on TOP of stack.
enumerating
-
nodeDo: anEnumerator
-
helper for parse tree walking
-
variableNodesDo: aBlock
-
helper for parse tree walking
evaluation
-
evaluateIn: anEnvironment
-
value method isWrapped ifTrue:[^ nil].
-
store: aValue
-
value method isWrapped ifTrue:[
printing & storing
-
displayOn: aGCOrStream
-
Compatibility
append a printed desription on some stream (Dolphin, Squeak)
OR:
display the receiver in a graphicsContext at 0@0 (ST80).
This method allows for any object to be displayed in some view
(although the fallBack is to display its printString ...)
-
printOn: aStream indent: i
-
actually only a debug-check
queries
-
canReuseAsArg: anotherNode
-
-
indexIn: aCompiler
-
testing
-
isArgument
-
return true, if this is a node for an argument (block or method)
-
isBlockArg
-
-
isBlockVariable
-
-
isClassVariable
-
-
isGlobal
-
return true, if this is a node for an existing! global variable
-
isGlobalNamed: nameWanted
-
return true, if this is a node for a particular
(and existing) global variable
-
isGlobalVariable
-
return true, if this is a node for global variable
-
isGlobalVariableNamed: nameWanted
-
return true, if this is a node for a particular
global variable (existing or not)
-
isInstance
-
-
isInstanceVariable
-
-
isInstanceVariableNamed: aString
-
-
isJAVA
-
Return true, if receiver is global variable node JAVA.
Used to highlight Java class references.
-
isJavaPackageReference
-
Return true, given node is JAVA package reference in form:
JAVA package1 package2
-
isLocal
-
return true, if this is a node for a local (block or method) variable
-
isLocalVariable
-
return true, if this is a node for a local (block or method) variable
-
isMethodArg
-
-
isMethodVariable
-
-
isPoolVariable
-
-
isUndeclared
-
-
isVariable
-
return true, if this is a node for a variable
visiting
-
acceptVisitor: aVisitor
-
Double dispatch back to the visitor, passing my type encoded in
the selector (visitor pattern)
|