Changes to get traditional functions with args. working

git-svn-id: svn://10.0.0.236/trunk@35302 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rogerl%netscape.com
1999-06-15 00:57:05 +00:00
parent 26c8590a2b
commit b5540991c3
10 changed files with 111 additions and 23 deletions

View File

@@ -1,9 +1,27 @@
class FunctionNode extends ExpressionNode {
FunctionNode(JSIdentifier aName, ControlNodeGroup aBody)
FunctionNode(JSIdentifier aName, ControlNodeGroup aBody, ExpressionNode parameterList)
{
fn = new NativeFunction(aBody.getHead());
name = aName;
if (parameterList != null) {
if (parameterList instanceof BinaryNode)
buildParameterVector((BinaryNode)parameterList);
else
fn.parameters.addElement(parameterList);
}
}
void buildParameterVector(BinaryNode x)
{
if (x.left instanceof BinaryNode) {
buildParameterVector((BinaryNode)(x.left));
fn.parameters.addElement(x.right);
}
else {
fn.parameters.addElement(x.left);
fn.parameters.addElement(x.right);
}
}
JSValue eval(Environment theEnv)