Project

General

Profile

root / trunk / compiler / cppAst / ast / statements / Call.hpp @ 7

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

    
23

    
24

    
25

    
26
#pragma once
27

    
28
#include <ast/statements/Statement.hpp>
29
#include <ast/expressions/Expression.hpp>
30
#include <ast/IAstVisitor.hpp>
31

    
32
namespace Ast {
33

    
34
class Call final
35
        : public Statement
36
{
37
protected:
38
        Expression* m_callExpression;
39

    
40
        Call():
41
                Statement(StatementKind::Call),
42
                m_callExpression(nullptr)
43
        {};
44
        Call(const Call& toCopy):
45
                Statement(toCopy),
46
                m_callExpression(toCopy.m_callExpression)
47
        {};
48

    
49
        static Call* create() {return new Call();}
50
        static Call* createCopy(const Call& toCopy) {return new Call(toCopy);}
51
public:
52
        friend class Ast;
53
        friend class Statement;
54

    
55
        void init(std::int32_t line,std::int32_t pos,Expression* callExprRef) {
56
                Statement::init(line,pos);
57
                m_callExpression = callExprRef;
58
        }
59

    
60
        Expression* callExpression() {return m_callExpression;};
61
        void setCallExpression(Expression* newExpression) {m_callExpression = newExpression;};
62
        void accept(IAstVisitor& visitor) override {visitor.visit(this);};
63
};
64
}