Project

General

Profile

root / trunk / compiler / cppAst / ast / expressions / TupleMapAccessExpression.hpp @ 3

1 2 krennw
/**
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/expressions/UnaryOperator.hpp>
29
#include <ast/IAstVisitor.hpp>
30
31
namespace Ast {
32
33
class TupleMapAccessExpression final
34
        : public UnaryOperator
35
{
36
protected:
37
        Expression* m_argument;
38
39
        TupleMapAccessExpression():
40
                UnaryOperator(ExpressionKind::TupleMapAccess),
41
                m_argument (nullptr)
42
        {};
43
        TupleMapAccessExpression(const TupleMapAccessExpression &toCopy):
44
                UnaryOperator(toCopy),
45
                m_argument (toCopy.m_argument)
46
        {};
47
48
        static TupleMapAccessExpression* create(ExpressionKind){return new TupleMapAccessExpression();}
49
        static TupleMapAccessExpression* createCopy(const TupleMapAccessExpression& toCopy){return new TupleMapAccessExpression(toCopy);}
50
public:
51
        friend class Ast;
52
        friend class Expression;
53
54
        void init(std::int32_t line, std::int32_t pos,
55
                        Type* typeRef,IdentifierList* callTargetsIdentifierListRef, SymbolTable* symbTabRef,
56
                        Expression* child, Expression* arg)
57
        {
58
                UnaryOperator::init(line,pos,typeRef,callTargetsIdentifierListRef, symbTabRef,child);
59
                m_argument = arg;
60
        }
61
62
63
        Expression* argument() {return m_argument;};
64
        void accept(IAstVisitor& visitor) override {visitor.visit(this);};
65
        void setArgument(Expression* newarg) {m_argument = newarg;};
66
};
67
}