|
Class: VariableNode
Object
|
+--ParseNode
|
+--PrimaryNode
|
+--VariableNode
|
+--JavaScriptVariableNode
- Package:
- stx:libcomp
- Category:
- System-Compiler-Support
- Version:
- rev:
1.116
date: 2024/02/09 11:43:51
- user: stefan
- file: VariableNode.st directory: libcomp
- module: stx stc-classLibrary: libcomp
node for parse-trees, representing variables
This is a helper class for the compiler.
copyrightCOPYRIGHT (c) 1994 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
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: 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
-
-
isImmutable
-
self isMethodArg ifTrue:[^ true].
testing
-
isArgument
-
return true, if this is a node for an argument (block or method)
-
isBlockArg
-
(comment from inherited method)
return true if this is a block argument
-
isBlockVariable
-
(comment from inherited method)
return false here; to be redefined in subclass(es)
-
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
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
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
-
(comment from inherited method)
return true, if this is a node for a method local variable variable
-
isPoolVariable
-
(comment from inherited method)
return false here; to be redefined in subclass(es)
-
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)
|