eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'BlockNode':

Home

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

Class: BlockNode


Inheritance:

   Object
   |
   +--ParseNode
      |
      +--BlockNode
         |
         +--JavaScriptParser::InnerJavaBlockNode

Package:
stx:libcomp
Category:
System-Compiler-Support
Version:
rev: 1.100 date: 2017/07/16 11:38:07
user: cg
file: BlockNode.st directory: libcomp
module: stx stc-classLibrary: libcomp
Author:
Claus Gittinger

Description:


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


Class protocol:

instance creation
o  arguments: argList home: homeBlock

o  arguments: argList home: homeBlock variables: vars

o  home: homeBlock

o  withExpression: exprNode in: home
a utility function for code generators


Instance protocol:

accessing
o  accessedOuterBlockVars
return a collection of outer blockVars/args which are accessed
in this block

o  arguments

o  arguments: argList

o  blockArgAccessed
return true if any block argument is accessed in the block

o  blockArgAccessed: aBoolen
set/clear the flag stating if any block argument is accessed in the block

o  charEndIndex

o  charEndIndex: something

o  charStartIndex

o  charStartIndex: something

o  endLineNumber

o  endLineNumber: aNumber

o  endPointIndex

o  endPointIndex: something

o  firstStatement
sigh - its a linked list

o  home

o  home: aBlock

o  indexOfFirstTemp: index

o  inlineBlock: aBoolean

o  invocationSelector
the selector, by which this block is invoked

o  invokationSelector

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

o  isInlineBlock

o  lastStatement
sigh - its a linked list

o  lineNumber

o  lineNumber: aNumber

o  lineNumberOfFirstMessage

o  needsHome

o  needsHome: aBoolean

o  nestingLevel

o  possiblyInlined: aBoolean

o  possiblyInlined: aBoolean withSelector: selector

o  statements

o  statements: s

o  variables

o  variables: varList

o  variablesIncludingInlined: forStcCompiledCode
Returns all my local variables including those of block inlined into
the receiver. If `forStcCompiledCode` is true then assume
the code is compiled by stc, otherwise assume the code is
compiled by bytecode compiler

block messages
o  doesNotUnderstand: aMessage
mhmh - a message which I don't understand, but Block implements

code generation
o  checkForSimpleBlockCodeOn: aStream for: aCompiler
simple things can be made cheap blocks right now -
resulting in a simple pushLit instruction ...
Return:
true -- bytecodes are on aStream
aParseNode -- Parsenode creating the cheap block
nil -- cheap block not possible

o  codeForSideEffectOn: aStream inBlock: b for: aCompiler
generate code for this statement - value not needed.
For blocks, no code is generated at all.

o  codeInlineOn: aStream inBlock: b for: aCompiler

o  codeInlineOn: aStream inBlock: b valueNeeded: valueNeeded for: aCompiler
have to move blockvars into surrounding context

o  codeOn: aStream inBlock: b for: aCompiler
if result == true - code is already on aStream

code generation helpers
o  addTempVar
add a temporary variable; return its position (1-based).
Used when a block with args/locals is inlined.

o  removeTempVar
remove a temporary variable

enumerating
o  allSubBlocksDo: aBlock
recursively enumerate all of my subblocks

o  nodeDo: anEnumerator
helper for parse tree walking

evaluation
o  evaluateIn: anEnvironment

o  exitWith: something
return via return-statement

o  value

o  value: anArg

o  value: arg1 value: arg2

o  value: arg1 value: arg2 value: arg3

o  value: arg1 value: arg2 value: arg3 value: arg4

o  valueWithArguments: argArray

o  wrongNumberOfArguments: numArgsGiven
report that the number of arguments given does not match the number expected

looping
o  whileFalse: aBlock

o  whileTrue: aBlock
evaluate the argument, aBlock while the receiver evaluates to true.

misc
o  rememberOuterBlockVarAccess: aVariableNode

o  rememberSubBlock: aBlockNode

printing & storing
o  printOn: aStream indent: i

private-accessing
o  setArguments: argList home: h

o  setArguments: argList home: h variables: vars

o  setHome: h

queries
o  argumentCount
ANSI alias for numArgs: return the number of arguments the block represented by myself
expects for evaluation

o  collectBlocksInto: aCollection

o  containsReturn

o  endsWithReturn

o  indexOfFirstTemp

o  isInlinable
return true, if the receiver is inlinable.
For now, do NOT inline a block, if it has args/vars
which are accessed by subblocks, which are themself
not inlinable.
This limitation is needed for the following piece of code to work:
1 to:10 do:[:i |
.... [ something with i ]
]
If this block was inlined, each subblock would get the same i
(which is the old ST/V behavior)

o  numArgs
return the number of arguments the block represented by myself
expects for evaluation.
Please use argumentCount, which is ANSI

o  numVars
return the number of block local variables.

o  simpleSendBlockExpression

statistics
o  modifiedLocalVars

o  rememberLocalModified: name

testing
o  isBlock
a kludge, to have blocknodes mimic blocks

o  isBlockNode

o  isBlockWithArgumentCount: numArgsExpected
a kludge, to have blocknodes mimic blocks

o  isEmptyBlock

o  isInlinedInto: blockNode assumeStcCompiled: assumeStc
Returns true, if the receiver is inlined into given `blockNode`.
If `assumeStc` is true. then assume the code is compiled by stc,
otherwise assume that the code is compiled by the bytecode compiler

o  isJavaScriptBlock

o  isSingleExpressionBlock

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



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Wed, 19 Sep 2018 03:12:23 GMT