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

function.cpp

Go to the documentation of this file.
00001 // function.cpp
00002 //
00003 // Copyright (C) 2002, Chris Laurel <claurel@shatters.net>
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 
00010 #include <celscript/function.h>
00011 #include <celscript/statement.h>
00012 #include <celscript/execution.h>
00013 
00014 using namespace celx;
00015 using namespace std;
00016 
00017 
00018 Function::Function(vector<string>* _args, Statement* _body) :
00019     arguments(_args), body(_body)
00020 {
00021 }
00022 
00023 Function::Function(const Function& f) :
00024     arguments(f.arguments), body(f.body)
00025 {
00026 }
00027 
00028 Function::~Function()
00029 {
00030     // delete arguments;
00031     // delete body;
00032 }
00033 
00034 
00035 Value Function::call(ExecutionContext& context)
00036 {
00037     Statement::Control control = body->execute(context);
00038     if (control == Statement::ControlReturn)
00039     {
00040         return context.popReturnValue();
00041     }
00042     else
00043     {
00044         return Value();
00045     }
00046 }
00047 

Generated on Sat Jan 14 22:30:32 2006 for Celestia by  doxygen 1.4.1