Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

celx::FunctionCallExpression Class Reference

#include <expression.h>

Inheritance diagram for celx::FunctionCallExpression:

Inheritance graph
Collaboration diagram for celx::FunctionCallExpression:

Collaboration graph
List of all members.

Public Member Functions

void addArgument (Expression *)
virtual Value eval (ExecutionContext &)
 FunctionCallExpression (Expression *)
 ~FunctionCallExpression ()

Private Attributes

std::vector< Expression * > arguments
Expressionfunc

Constructor & Destructor Documentation

FunctionCallExpression::FunctionCallExpression Expression  ) 
 

Definition at line 215 of file expression.cpp.

00215                                                                 :
00216     func(_func)
00217 {
00218 }

FunctionCallExpression::~FunctionCallExpression  ) 
 

Definition at line 220 of file expression.cpp.

References arguments, and func.

00221 {
00222     if (func != NULL)
00223         delete func;
00224     for (vector<Expression*>::iterator iter = arguments.begin();
00225          iter != arguments.end(); iter++)
00226     {
00227         delete *iter;
00228     }
00229 }


Member Function Documentation

void FunctionCallExpression::addArgument Expression  ) 
 

Definition at line 245 of file expression.cpp.

References arguments.

00246 {
00247     arguments.insert(arguments.end(), expr);
00248 }

Value FunctionCallExpression::eval ExecutionContext  )  [virtual]
 

Implements celx::Expression.

Definition at line 231 of file expression.cpp.

References celx::Function::call(), celx::Expression::eval(), func, and celx::Value::functionValue().

00232 {
00233     Value funcVal = func->eval(context);
00234     Function* f;
00235     if (!funcVal.functionValue(f))
00236     {
00237         // Not a function
00238         context.runtimeError();
00239         return Value();
00240     }
00241 
00242     return f->call(context);
00243 }


Member Data Documentation

std::vector<Expression*> celx::FunctionCallExpression::arguments [private]
 

Definition at line 137 of file expression.h.

Referenced by addArgument(), and ~FunctionCallExpression().

Expression* celx::FunctionCallExpression::func [private]
 

Definition at line 136 of file expression.h.

Referenced by eval(), and ~FunctionCallExpression().


The documentation for this class was generated from the following files:
Generated on Sat Jan 14 22:33:45 2006 for Celestia by  doxygen 1.4.1