aboutsummaryrefslogtreecommitdiff
path: root/src/functionast.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-12-21 18:04:02 +0000
committerMike Buland <eichlan@xagasoft.com>2009-12-21 18:04:02 +0000
commitfb28f6800864176be2ffca29e8e664b641f33170 (patch)
treeba9180ac442939edc4eacbe1fdae93c5a7f87cee /src/functionast.cpp
parent51e21a316be6e052251b3dfc7d671061ebd67cee (diff)
downloadbuild-fb28f6800864176be2ffca29e8e664b641f33170.tar.gz
build-fb28f6800864176be2ffca29e8e664b641f33170.tar.bz2
build-fb28f6800864176be2ffca29e8e664b641f33170.tar.xz
build-fb28f6800864176be2ffca29e8e664b641f33170.zip
m3 is copied into trunk, we should be good to go, now.
Diffstat (limited to 'src/functionast.cpp')
-rw-r--r--src/functionast.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/functionast.cpp b/src/functionast.cpp
new file mode 100644
index 0000000..0d9a938
--- /dev/null
+++ b/src/functionast.cpp
@@ -0,0 +1,33 @@
1#include "functionast.h"
2#include "astbranch.h"
3#include "astleaf.h"
4#include "runner.h"
5#include "context.h"
6
7FunctionAst::FunctionAst( const AstBranch *pRoot, class Runner *pRunner ) :
8 pRoot( pRoot ),
9 pRunner( pRunner )
10{
11 sName = dynamic_cast<AstLeaf *>(
12 *(*pRoot->getBranchBegin()).begin()
13 )->getStrValue();
14}
15
16FunctionAst::~FunctionAst()
17{
18}
19
20Bu::FString FunctionAst::getName() const
21{
22 return sName;
23}
24
25Variable FunctionAst::call( Variable &input, VarList /*lParams*/ )
26{
27 pContext->pushScope();
28 pContext->addVariable("INPUT", input );
29 Variable vRet = pRunner->run( (*(pRoot->getBranchBegin()+2)).begin() );
30 pContext->popScope();
31 return vRet;
32}
33