|
Class: BlockNode
Object
|
+--ParseNode
|
+--BlockNode
|
+--JavaScriptParser::InnerJavaBlockNode
- Package:
- stx:libcomp
- Category:
- System-Compiler-Support
- Version:
- rev:
1.101
date: 2019/08/17 11:54:23
- user: cg
- file: BlockNode.st directory: libcomp
- module: stx stc-classLibrary: libcomp
- Author:
- Claus Gittinger
node for parse-trees, representing blocks
This is a helper class for the compiler.
instance creation
-
arguments: argList home: homeBlock
-
-
arguments: argList home: homeBlock variables: vars
-
-
home: homeBlock
-
-
withExpression: exprNode in: home
-
a utility function for code generators
accessing
-
accessedOuterBlockVars
-
return a collection of outer blockVars/args which are accessed
in this block
-
arguments
-
-
arguments: argList
-
-
blockArgAccessed
-
return true if any block argument is accessed in the block
-
blockArgAccessed: aBoolen
-
set/clear the flag stating if any block argument is accessed in the block
-
charEndIndex
-
-
charEndIndex: something
-
-
charStartIndex
-
-
charStartIndex: something
-
-
endLineNumber
-
-
endLineNumber: aNumber
-
-
endPointIndex
-
-
endPointIndex: something
-
-
firstStatement
-
sigh - its a linked list
-
home
-
-
home: aBlock
-
-
indexOfFirstTemp: index
-
-
inlineBlock: aBoolean
-
-
invocationSelector
-
the selector, by which this block is invoked
-
invokationSelector
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
isInlineBlock
-
-
lastStatement
-
sigh - its a linked list
-
lineNumber
-
-
lineNumber: aNumber
-
-
lineNumberOfFirstMessage
-
-
needsHome
-
-
needsHome: aBoolean
-
-
nestingLevel
-
-
possiblyInlined: aBoolean
-
-
possiblyInlined: aBoolean withSelector: selector
-
-
statements
-
-
statements: s
-
-
variables
-
-
variables: varList
-
-
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
-
doesNotUnderstand: aMessage
-
mhmh - a message which I don't understand, but Block implements
code generation
-
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
-
codeForSideEffectOn: aStream inBlock: b for: aCompiler
-
generate code for this statement - value not needed.
For blocks, no code is generated at all.
-
codeInlineOn: aStream inBlock: b for: aCompiler
-
-
codeInlineOn: aStream inBlock: b valueNeeded: valueNeeded for: aCompiler
-
have to move blockvars into surrounding context
-
codeOn: aStream inBlock: b for: aCompiler
-
if result == true - code is already on aStream
code generation helpers
-
addTempVar
-
add a temporary variable; return its position (1-based).
Used when a block with args/locals is inlined.
-
removeTempVar
-
remove a temporary variable
enumerating
-
allSubBlocksDo: aBlock
-
recursively enumerate all of my subblocks
-
nodeDo: anEnumerator
-
helper for parse tree walking
evaluation
-
evaluateIn: anEnvironment
-
-
exitWith: something
-
return via return-statement
-
value
-
-
value: anArg
-
-
value: arg1 value: arg2
-
-
value: arg1 value: arg2 value: arg3
-
-
value: arg1 value: arg2 value: arg3 value: arg4
-
-
valueWithArguments: argArray
-
-
wrongNumberOfArguments: numArgsGiven
-
report that the number of arguments given does not match the number expected
looping
-
whileFalse: aBlock
-
-
whileTrue: aBlock
-
evaluate the argument, aBlock while the receiver evaluates to true.
misc
-
rememberOuterBlockVarAccess: aVariableNode
-
-
rememberSubBlock: aBlockNode
-
printing & storing
-
printOn: aStream indent: i
-
private-accessing
-
setArguments: argList home: h
-
-
setArguments: argList home: h variables: vars
-
-
setHome: h
-
queries
-
argumentCount
-
ANSI alias for numArgs: return the number of arguments the block represented by myself
expects for evaluation
-
collectBlocksInto: aCollection
-
-
containsReturn
-
-
endsWithReturn
-
-
indexOfFirstTemp
-
-
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)
-
numArgs
-
return the number of arguments the block represented by myself
expects for evaluation.
Please use argumentCount, which is ANSI
-
numVars
-
return the number of block local variables.
-
simpleSendBlockExpression
-
statistics
-
modifiedLocalVars
-
-
rememberLocalModified: name
-
testing
-
isBlock
-
a kludge, to have blocknodes mimic blocks
-
isBlockNode
-
-
isBlockWithArgumentCount: numArgsExpected
-
a kludge, to have blocknodes mimic blocks
-
isEmptyBlock
-
-
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
-
isJavaScriptBlock
-
-
isSingleExpressionBlock
-
visiting
-
acceptVisitor: aVisitor
-
Double dispatch back to the visitor, passing my type encoded in
the selector (visitor pattern)
|