eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'JavaScriptFunctionNode':

Home

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

Class: JavaScriptFunctionNode


Inheritance:

   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

Description:


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.

copyright

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

Instance protocol:

accessing
o  _argVariables

o  _argVariables: aDictionary

o  _localVariables

o  _localVariables: aDictionary

o  _outerEnvironment

o  _outerEnvironment: anEnvironment

o  _topEnvironment

o  addLocalVariable: aVariable

o  allVisibleVariables
return the variable-nodes for visible arguments and locals;
this includes outer-scope variables

o  argumentCount
argumentCount

o  arguments
return the value of the instance variable 'arguments' (automatically generated)

o  arguments: something
set the value of the instance variable 'arguments' (automatically generated)

o  functionName
return the value of the instance variable 'functionName' (automatically generated)

o  functionName: something
set the value of the instance variable 'functionName' (automatically generated)

o  isAsync

o  isAsync: aBoolean

o  isReturnedFrom

o  isReturnedFrom: aBoolean
Modified (format): / 17-03-2022 / 09:51:08 / cg

o  lineNumber

o  lineNumber: anInteger
(comment from inherited method)
set linenumber - ignored here

o  localVariableNames
Modified (format): / 14-02-2019 / 11:12:33 / Claus Gittinger

o  localVariables

o  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) **

o  numVars
return the number of local variables.

o  statements
return the value of the instance variable 'statements' (automatically generated)

o  statements: aStatementNode
set the value of the instance variable 'statements' (automatically generated)

o  variableValue
that is a bad kludge to fix the interpreter, which gets functionNodes as value

o  xxxx_variables

code generation
o  codeVariableSetupOn: codeStream for: aCompiler
generate code to set it up.

enumeration
o  allSubNodesDo: aBlock
evaluate aBlock for each subnode

o  childrenDo: aBlock
evaluate aBlock for each subnode

o  messageSelectorsDo: aBlock
evaluate aBlock for each message-selector sent by this node and subnodes

o  messagesDo: aBlock
evaluate aBlock for each message-node sent by this node and subnodes

o  statementsDo: aBlock

o  variableNodesDo: aBlock
evaluate aBlock for each variable-node in this node and subnodes;
that is: all references to any variable inside the code

evaluation
o  exitWith: something
return via return-statement

Usage example(s):

home exitWith:something

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.

o  value: arg

o  value: arg1 value: arg2
nil

o  value: arg1 value: arg2 value: arg3

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

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

o  value: arg1 value: arg2 value: arg3 value: arg4 value: arg5 value: arg6

o  value: arg1 value: arg2 value: arg3 value: arg4 value: arg5 value: arg6 value: arg7

o  value: arg1 value: arg2 value: arg3 value: arg4 value: arg5 value: arg6 value: arg7 value: arg8

o  valueWithArguments: args

o  valueWithReceiver: rec arguments: args
exitBlock := [:v |

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

printing
o  printOn: aStream indent: i
aStream cr.

queries
o  _isFunctionEnvironment

o  _isHTMLEnvironment

o  home

o  isFunctionNode

testing
o  isInlineBlock

visiting
o  acceptVisitor: visitor
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; Thu, 02 May 2024 22:37:58 GMT