diff options
Diffstat (limited to 'src/functionast.cpp')
| -rw-r--r-- | src/functionast.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/functionast.cpp b/src/functionast.cpp index d4ec61f..437ddd4 100644 --- a/src/functionast.cpp +++ b/src/functionast.cpp | |||
| @@ -8,12 +8,12 @@ | |||
| 8 | using namespace Bu; | 8 | using namespace Bu; |
| 9 | 9 | ||
| 10 | FunctionAst::FunctionAst( const AstBranch *pRoot, class Runner *pRunner ) : | 10 | FunctionAst::FunctionAst( const AstBranch *pRoot, class Runner *pRunner ) : |
| 11 | pRoot( pRoot ), | 11 | pRoot( pRoot ), |
| 12 | pRunner( pRunner ) | 12 | pRunner( pRunner ) |
| 13 | { | 13 | { |
| 14 | sName = dynamic_cast<AstLeaf *>( | 14 | sName = dynamic_cast<AstLeaf *>( |
| 15 | *(*pRoot->getBranchBegin()).begin() | 15 | *(*pRoot->getBranchBegin()).begin() |
| 16 | )->getStrValue(); | 16 | )->getStrValue(); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | FunctionAst::~FunctionAst() | 19 | FunctionAst::~FunctionAst() |
| @@ -22,26 +22,26 @@ FunctionAst::~FunctionAst() | |||
| 22 | 22 | ||
| 23 | Bu::String FunctionAst::getName() const | 23 | Bu::String FunctionAst::getName() const |
| 24 | { | 24 | { |
| 25 | return sName; | 25 | return sName; |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | Variable FunctionAst::call( Variable &input, VarList lParams ) | 28 | Variable FunctionAst::call( Variable &input, VarList lParams ) |
| 29 | { | 29 | { |
| 30 | pContext->pushScope(); | 30 | pContext->pushScope(); |
| 31 | 31 | ||
| 32 | AstBranch::NodeList::const_iterator vName = | 32 | AstBranch::NodeList::const_iterator vName = |
| 33 | (*(pRoot->getBranchBegin()+1)).begin(); | 33 | (*(pRoot->getBranchBegin()+1)).begin(); |
| 34 | VarList::iterator vValue = lParams.begin(); | 34 | VarList::iterator vValue = lParams.begin(); |
| 35 | for( ; vName && vValue; vName++, vValue++ ) | 35 | for( ; vName && vValue; vName++, vValue++ ) |
| 36 | { | 36 | { |
| 37 | pContext->addVariable( | 37 | pContext->addVariable( |
| 38 | dynamic_cast<const AstLeaf *>(*vName)->getStrValue(), | 38 | dynamic_cast<const AstLeaf *>(*vName)->getStrValue(), |
| 39 | *vValue | 39 | *vValue |
| 40 | ); | 40 | ); |
| 41 | } | 41 | } |
| 42 | pContext->addVariable("INPUT", input ); | 42 | pContext->addVariable("INPUT", input ); |
| 43 | Variable vRet = pRunner->run( (*(pRoot->getBranchBegin()+2)).begin() ); | 43 | Variable vRet = pRunner->run( (*(pRoot->getBranchBegin()+2)).begin() ); |
| 44 | pContext->popScope(); | 44 | pContext->popScope(); |
| 45 | return vRet; | 45 | return vRet; |
| 46 | } | 46 | } |
| 47 | 47 | ||
