eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'RBLiteralNode':

Home

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

Class: RBLiteralNode


Inheritance:

   Object
   |
   +--RBProgramNode
      |
      +--RBStatementNode
         |
         +--RBValueNode
            |
            +--RBLiteralNode
               |
               +--RBLiteralArrayNode
               |
               +--RBLiteralValueNode
               |
               +--RBSyntheticLiteralNode

Package:
stx:goodies/refactoryBrowser/parser
Category:
Refactory-AST-Nodes
Version:
rev: 1.41 date: 2021/01/20 12:18:01
user: cg
file: RBLiteralNode.st directory: goodies/refactoryBrowser/parser
module: stx stc-classLibrary: parser

Description:


BRLiteralNode is an AST node that represents literals (e.g., #foo, #(1 2 3), true, etc.).

Instance Variables:
        token   <BRLiteralToken>        the token that contains the literal value as well as its source positions


Class protocol:

instance creation
o  literalToken: aLiteralToken

o  value: aValue


Instance protocol:

accessing
o  generatedCode

o  precedence

o  startWithoutParentheses

o  stopWithoutParentheses

o  token

o  value
(comment from inherited method)
return the receiver itself.
This allows every object to be used where blocks or valueHolders
are typically used, and allows for valueHolders and blocks to be
used interchangably in some situations.

Time will show, if this is a good idea or leads to sloppy programming
style ... (the idea was borrowed from the Self language).

WARNING: don't 'optimize' away ifXXX: blocks
(i.e. do NOT replace
foo ifTrue:[var1] ifFalse:[var2]
by:
foo ifTrue:var1 ifFalse:var2
)
- the compilers will only generate inline code for the if,
iff the argument(s) are blocks - otherwise, a true send is
generated.
This 'optimization' will work semantically correct,
but execute SLOWER instead.

Using constants (foo ifTrue:1 ifFalse:2) does not introduce a performance penalty.

comparing
o  = anObject
avoid precision bug with floats

o  hash
(comment from inherited method)
return an Integer useful as a hash key for the receiver.
This hash should return same values for objects with same
contents (i.e. use this to hash on structure)

enumeration
o  allLiteralNodesDo: aBlock

initialization & release
o  literalToken: aLiteralToken

matching
o  copyInContext: aDictionary

o  match: aNode inContext: aDictionary
ST/X: patternStringLiteral

special queries
o  addUsedLiteralsTo: aCollection
adds the value of the literal to aCollection

o  addUsedSymbolsTo: aCollection

testing
o  hasFalseValue

o  hasTrueValue

o  isImmediate

o  isLiteral

o  isLiteralArray

o  isLiteralByteArray

o  isLiteralCharacter

o  isLiteralFloat

o  isLiteralInteger

o  isLiteralNil

o  isLiteralNode

o  isLiteralNumber

o  isLiteralString

o  isLiteralSymbol

visitor
o  acceptVisitor: aProgramNodeVisitor



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Thu, 21 Nov 2024 12:08:36 GMT