Project

General

Profile

7 krennw
/**
*
* OOAS Compiler - C++ AST
*
* Copyright 2015, AIT Austrian Institute of Technology.
* All rights reserved.
*
* SEE THE "LICENSE" FILE FOR THE TERMS UNDER WHICH THIS FILE IS PROVIDED.
*
* If you modify the file please update the list of contributors below to in-
* clude your name. Please also stick to the coding convention of using TABs
* to do the basic (block-level) indentation and spaces for anything after
* that. (Enable the display of special chars and it should be pretty obvious
* what this means.) Also, remove all trailing whitespace.
*
* Contributors:
* Willibald Krenn (AIT)
* Stephan Zimmerer (AIT)
* Christoph Czurda (AIT)
*
*/
2 krennw



#pragma once

#include <ast/expressions/UnaryOperator.hpp>
#include <ast/IAstVisitor.hpp>
#include <deque>
#include <ast/IScope.hpp>

namespace Ast {

class CallExpression final
: public UnaryOperator
{
private:
ExpressionList m_arguments;
IScope* m_callScope;

CallExpression():
UnaryOperator(ExpressionKind::Call),
m_arguments (),
m_callScope (nullptr)
{};
CallExpression(const CallExpression &toCopy):
UnaryOperator(toCopy),
m_arguments (toCopy.m_arguments),
m_callScope (toCopy.m_callScope)
{};

static CallExpression* create(ExpressionKind) {return new CallExpression();}
static CallExpression* createCopy(const CallExpression& toCopy) {return new CallExpression(toCopy);}
public:
friend class Ast;
friend class Expression;

void init(std::int32_t line, std::int32_t pos,
Type* typeRef,IdentifierList* callTargetsIdentifierListRef, SymbolTable* symbTabRef,
Expression* child, ExpressionList* argumentList, IScope* scopeRef)
{
UnaryOperator::init(line,pos,typeRef,callTargetsIdentifierListRef, symbTabRef,child);
m_arguments = std::move(*argumentList);
m_callScope = scopeRef;
}

ExpressionList& arguments() {return m_arguments;};
IScope* scope() {return m_callScope;};
void accept(IAstVisitor& visitor) override {visitor.visit(this);};
//void setArguments(ExpressionList& newArgs) {m_arguments = newArgs;};
};
}