aboutsummaryrefslogtreecommitdiff
path: root/src/functionast.cpp
diff options
context:
space:
mode:
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