From fb28f6800864176be2ffca29e8e664b641f33170 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 21 Dec 2009 18:04:02 +0000 Subject: m3 is copied into trunk, we should be good to go, now. --- src/functionast.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/functionast.cpp (limited to 'src/functionast.cpp') 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 @@ +#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( + *(*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; +} + -- cgit v1.2.3