blob: 0d9a93890c374757f699052bf08b526b87403ea0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include "functionast.h"
#include "astbranch.h"
#include "astleaf.h"
#include "runner.h"
#include "context.h"
FunctionAst::FunctionAst( const AstBranch *pRoot, class Runner *pRunner ) :
pRoot( pRoot ),
pRunner( pRunner )
{
sName = dynamic_cast<AstLeaf *>(
*(*pRoot->getBranchBegin()).begin()
)->getStrValue();
}
FunctionAst::~FunctionAst()
{
}
Bu::FString FunctionAst::getName() const
{
return sName;
}
Variable FunctionAst::call( Variable &input, VarList /*lParams*/ )
{
pContext->pushScope();
pContext->addVariable("INPUT", input );
Variable vRet = pRunner->run( (*(pRoot->getBranchBegin()+2)).begin() );
pContext->popScope();
return vRet;
}
|