aboutsummaryrefslogtreecommitdiff
path: root/src/functionast.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/functionast.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/functionast.cpp b/src/functionast.cpp
index 0d9a938..ceee460 100644
--- a/src/functionast.cpp
+++ b/src/functionast.cpp
@@ -4,6 +4,9 @@
4#include "runner.h" 4#include "runner.h"
5#include "context.h" 5#include "context.h"
6 6
7#include <bu/sio.h>
8using namespace Bu;
9
7FunctionAst::FunctionAst( const AstBranch *pRoot, class Runner *pRunner ) : 10FunctionAst::FunctionAst( const AstBranch *pRoot, class Runner *pRunner ) :
8 pRoot( pRoot ), 11 pRoot( pRoot ),
9 pRunner( pRunner ) 12 pRunner( pRunner )
@@ -22,9 +25,20 @@ Bu::FString FunctionAst::getName() const
22 return sName; 25 return sName;
23} 26}
24 27
25Variable FunctionAst::call( Variable &input, VarList /*lParams*/ ) 28Variable FunctionAst::call( Variable &input, VarList lParams )
26{ 29{
27 pContext->pushScope(); 30 pContext->pushScope();
31
32 AstBranch::NodeList::const_iterator vName =
33 (*(pRoot->getBranchBegin()+1)).begin();
34 VarList::iterator vValue = lParams.begin();
35 for( ; vName && vValue; vName++, vValue++ )
36 {
37 pContext->addVariable(
38 dynamic_cast<const AstLeaf *>(*vName)->getStrValue(),
39 *vValue
40 );
41 }
28 pContext->addVariable("INPUT", input ); 42 pContext->addVariable("INPUT", input );
29 Variable vRet = pRunner->run( (*(pRoot->getBranchBegin()+2)).begin() ); 43 Variable vRet = pRunner->run( (*(pRoot->getBranchBegin()+2)).begin() );
30 pContext->popScope(); 44 pContext->popScope();