eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'VariableNode':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: VariableNode


Inheritance:

   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

Description:


node for parse-trees, representing variables
This is a helper class for the compiler.


Class protocol:

instance creation
o  blockArgumentNamed: n

o  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

o  methodArgumentNamed: n

o  methodLocalNamed: n

o  type: t class: class name: n

o  type: t context: aContext

o  type: t holder: holder name: n

o  type: t name: n

o  type: t name: n context: aContext index: i

o  type: t name: n index: i selfClass: s

o  type: t name: n index: i selfValue: s

o  type: t name: n token: tok index: i

o  type: t name: n token: tok index: i block: b from: codeBlock


Instance protocol:

accessing
o  block

o  block: something

o  index

o  index: anIntegerIndex
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).

o  name

o  name: something

o  token

o  token: something

o  type

o  type: t class: class name: n
type == #PoolVariable ifTrue:[self breakPoint:#cg].

o  type: t context: aContext

o  type: t holder: holder name: n

o  type: t name: n

o  type: t name: n context: aContext index: anIntegerIndex
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).

o  type: t name: n index: anIntegerIndex selfClass: s
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).

o  type: t name: n index: anIntegerIndex selfValue: s
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).

o  type: t name: n token: tok index: anIntegerIndex
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).

o  type: t name: n token: tok index: anIntegerIndex block: variableBlock from: codeBlock
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).

o  type: t token: tok index: anIntegerIndex block: b
self assert:(anIntegerIndex isNil or:[anIntegerIndex ~~ 0]).

code generation
o  codeForSideEffectOn: aStream inBlock: b for: aCompiler
no code at all

o  codeForSimpleReturnOn: aStream inBlock: b lineNumber: lineNrOrNil for: aCompiler
anything else must be pushed, then top returned

o  codeLoadOn: aStream type: type index: index inBlock: codeBlock for: aCompiler
compiling for codeBlock; accessing variable in block.

o  codeOn: aStream inBlock: codeBlock for: aCompiler

o  codeStoreOn: aStream inBlock: codeBlock valueNeeded: valueNeeded for: aCompiler

o  codeStoreOn: aStream type: type index: index inBlock: codeBlock valueNeeded: valueNeeded for: aCompiler
value to be stored is on TOP of stack.

enumerating
o  nodeDo: anEnumerator
helper for parse tree walking

o  variableNodesDo: aBlock
helper for parse tree walking

evaluation
o  evaluateIn: anEnvironment
value method isWrapped ifTrue:[^ nil].

o  store: aValue
value method isWrapped ifTrue:[

printing & storing
o  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 ...)

o  printOn: aStream indent: i
actually only a debug-check

queries
o  canReuseAsArg: anotherNode

o  indexIn: aCompiler

testing
o  isArgument
return true, if this is a node for an argument (block or method)

o  isBlockArg

o  isBlockVariable

o  isClassVariable

o  isGlobal
return true, if this is a node for an existing! global variable

o  isGlobalNamed: nameWanted
return true, if this is a node for a particular
(and existing) global variable

o  isGlobalVariable
return true, if this is a node for global variable

o  isGlobalVariableNamed: nameWanted
return true, if this is a node for a particular
global variable (existing or not)

o  isInstance

o  isInstanceVariable

o  isInstanceVariableNamed: aString

o  isJAVA
Return true, if receiver is global variable node JAVA.
Used to highlight Java class references.

o  isJavaPackageReference
Return true, given node is JAVA package reference in form:
JAVA package1 package2

o  isLocal
return true, if this is a node for a local (block or method) variable

o  isLocalVariable
return true, if this is a node for a local (block or method) variable

o  isMethodArg

o  isMethodVariable

o  isPoolVariable

o  isUndeclared

o  isVariable
return true, if this is a node for a variable

visiting
o  acceptVisitor: aVisitor
Double dispatch back to the visitor, passing my type encoded in
the selector (visitor pattern)



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 18 Apr 2024 06:53:00 GMT