Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
MethodCallExpression.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <ext/foreach>
9
10#include <ast/Expression.h>
12
13namespace cli {
14
16 std::unique_ptr < Expression > m_object;
17 std::string m_name;
18 std::vector < std::unique_ptr < Expression > > m_params;
19
20public:
21 MethodCallExpression ( std::unique_ptr < Expression > object, std::string name, std::vector < std::unique_ptr < Expression > > params ) : m_object ( std::move ( object ) ), m_name ( std::move ( name ) ), m_params ( std::move ( params ) ) {
22 }
23
24 std::shared_ptr < abstraction::Value > translateAndEval ( Environment & environment ) const override {
26 params.push_back ( m_object->translateAndEval ( environment ) );
27 for ( const std::unique_ptr < Expression > & param : m_params ) {
28 params.push_back ( param->translateAndEval ( environment ) );
29 }
30
31 std::string name = m_name;
32
33 ext::vector < std::string > templateParams;
34/* for ( const std::unique_ptr < cli::Arg > & templateParam : m_templateParams )
35 templateParams.push_back ( templateParam->eval ( environment ) );*/
36
38/* if ( m_category )
39 category = m_category->getCategory ( );*/
40
41 return abstraction::EvalHelper::evalAlgorithm ( environment, name, templateParams, params, category );
42 }
43};
44
45} /* namespace cli */
46
AlgorithmCategory
Definition: AlgorithmCategories.hpp:14
static std::shared_ptr< abstraction::Value > evalAlgorithm(abstraction::TemporariesHolder &environment, const std::string &name, const ext::vector< std::string > &templateParams, const ext::vector< std::shared_ptr< abstraction::Value > > &params, abstraction::AlgorithmCategories::AlgorithmCategory category)
Definition: EvalHelper.cpp:14
Definition: Environment.h:29
Definition: Expression.h:14
Definition: MethodCallExpression.h:15
MethodCallExpression(std::unique_ptr< Expression > object, std::string name, std::vector< std::unique_ptr< Expression > > params)
Definition: MethodCallExpression.h:21
std::shared_ptr< abstraction::Value > translateAndEval(Environment &environment) const override
Definition: MethodCallExpression.h:24
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Definition: Arg.h:11
Definition: AnyObject.h:28
Definition: FordFulkerson.hpp:16