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.116 date: 2024/02/09 11:43:51
user: stefan
file: VariableNode.st directory: libcomp
module: stx stc-classLibrary: libcomp

Description:


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

copyright

COPYRIGHT (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.

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: 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

o  isImmutable
self isMethodArg ifTrue:[^ true].

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

o  isBlockArg
(comment from inherited method)
return true if this is a block argument

o  isBlockVariable
(comment from inherited method)
return false here; to be redefined in subclass(es)

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

** This is an obsolete interface - do not use it (it may vanish in future versions) **

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
(comment from inherited method)
return true, if this is a node for a method local variable variable

o  isPoolVariable
(comment from inherited method)
return false here; to be redefined in subclass(es)

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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 08:49:16 GMT