diff options
Diffstat (limited to '')
-rw-r--r-- | src/functionast.cpp | 16 |
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> | ||
8 | using namespace Bu; | ||
9 | |||
7 | FunctionAst::FunctionAst( const AstBranch *pRoot, class Runner *pRunner ) : | 10 | FunctionAst::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 | ||
25 | Variable FunctionAst::call( Variable &input, VarList /*lParams*/ ) | 28 | Variable 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(); |