|
Class: JavaScriptFunctionNode
Object
|
+--ParseNode
|
+--JavaScriptFunctionNode
|
+--JavaScriptInnerFunctionNode
- Package:
- stx:libjavascript
- Category:
- Languages-JavaScript-Compiling & Parsing
- Version:
- rev:
1.54
date: 2024/02/09 11:30:24
- user: stefan
- file: JavaScriptFunctionNode.st directory: libjavascript
- module: stx stc-classLibrary: libjavascript
ATTENTION: for protocol compatibility with JavaScriptEnvironment.
many messages are implemented with an initial underscore.
These are required as JavaScriptEnvironment catches doesNotUnderstand and
does some kludgy fiddling there.
copyrightCOPYRIGHT (c) 1998 by eXept Software AG
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.
accessing
-
_argVariables
-
-
_argVariables: aDictionary
-
-
_localVariables
-
-
_localVariables: aDictionary
-
-
_outerEnvironment
-
-
_outerEnvironment: anEnvironment
-
-
_topEnvironment
-
-
addLocalVariable: aVariable
-
-
allVisibleVariables
-
return the variable-nodes for visible arguments and locals;
this includes outer-scope variables
-
argumentCount
-
argumentCount
-
arguments
-
return the value of the instance variable 'arguments' (automatically generated)
-
arguments: something
-
set the value of the instance variable 'arguments' (automatically generated)
-
functionName
-
return the value of the instance variable 'functionName' (automatically generated)
-
functionName: something
-
set the value of the instance variable 'functionName' (automatically generated)
-
isAsync
-
-
isAsync: aBoolean
-
-
isReturnedFrom
-
-
isReturnedFrom: aBoolean
-
Modified (format): / 17-03-2022 / 09:51:08 / cg
-
lineNumber
-
-
lineNumber: anInteger
-
(comment from inherited method)
set linenumber - ignored here
-
localVariableNames
-
Modified (format): / 14-02-2019 / 11:12:33 / Claus Gittinger
-
localVariables
-
-
numArgs
-
marked as obsolete by Stefan Vogel at 9-Feb-2024
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
numVars
-
return the number of local variables.
-
statements
-
return the value of the instance variable 'statements' (automatically generated)
-
statements: aStatementNode
-
set the value of the instance variable 'statements' (automatically generated)
-
variableValue
-
that is a bad kludge to fix the interpreter, which gets functionNodes as value
-
xxxx_variables
-
code generation
-
codeVariableSetupOn: codeStream for: aCompiler
-
generate code to set it up.
enumeration
-
allSubNodesDo: aBlock
-
evaluate aBlock for each subnode
-
childrenDo: aBlock
-
evaluate aBlock for each subnode
-
messageSelectorsDo: aBlock
-
evaluate aBlock for each message-selector sent by this node and subnodes
-
messagesDo: aBlock
-
evaluate aBlock for each message-node sent by this node and subnodes
-
statementsDo: aBlock
-
-
variableNodesDo: aBlock
-
evaluate aBlock for each variable-node in this node and subnodes;
that is: all references to any variable inside the code
evaluation
-
exitWith: something
-
return via return-statement
Usage example(s):
-
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.
-
value: arg
-
-
value: arg1 value: arg2
-
nil
-
value: arg1 value: arg2 value: arg3
-
-
value: arg1 value: arg2 value: arg3 value: arg4
-
-
value: arg1 value: arg2 value: arg3 value: arg4 value: arg5
-
-
value: arg1 value: arg2 value: arg3 value: arg4 value: arg5 value: arg6
-
-
value: arg1 value: arg2 value: arg3 value: arg4 value: arg5 value: arg6 value: arg7
-
-
value: arg1 value: arg2 value: arg3 value: arg4 value: arg5 value: arg6 value: arg7 value: arg8
-
-
valueWithArguments: args
-
-
valueWithReceiver: rec arguments: args
-
exitBlock := [:v |
-
wrongNumberOfArguments: numArgsGiven
-
report that the number of arguments given does not match the number expected
printing
-
printOn: aStream indent: i
-
aStream cr.
queries
-
_isFunctionEnvironment
-
-
_isHTMLEnvironment
-
-
home
-
-
isFunctionNode
-
testing
-
isInlineBlock
-
visiting
-
acceptVisitor: visitor
-
Double dispatch back to the visitor, passing my type encoded in
the selector (visitor pattern)
|