1 |
7
|
krennw
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
2
|
krennw
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
#pragma once
|
27 |
|
|
|
28 |
|
|
#include <ast/expressions/TypeConstructionExpression.hpp>
|
29 |
|
|
#include <ast/IAstVisitor.hpp>
|
30 |
|
|
#include <ast/identifiers/Identifier.hpp>
|
31 |
|
|
#include <deque>
|
32 |
|
|
|
33 |
|
|
namespace Ast {
|
34 |
|
|
|
35 |
|
|
class TupleConstructor final
|
36 |
|
|
: public TypeConstructionExpression
|
37 |
|
|
{
|
38 |
|
|
protected:
|
39 |
|
|
ExpressionList m_values;
|
40 |
|
|
Identifier* m_tupleType;
|
41 |
|
|
bool m_matcher;
|
42 |
|
|
|
43 |
|
|
TupleConstructor():
|
44 |
|
|
TypeConstructionExpression(ExpressionKind::TupleConstr),
|
45 |
|
|
m_values(),
|
46 |
|
|
m_tupleType(nullptr),
|
47 |
|
|
m_matcher(false)
|
48 |
|
|
{};
|
49 |
|
|
TupleConstructor(const TupleConstructor &toCopy):
|
50 |
|
|
TypeConstructionExpression(toCopy),
|
51 |
|
|
m_values(toCopy.m_values),
|
52 |
|
|
m_tupleType(toCopy.m_tupleType),
|
53 |
|
|
m_matcher(toCopy.m_matcher)
|
54 |
|
|
{};
|
55 |
|
|
|
56 |
|
|
static TupleConstructor* create(ExpressionKind) {return new TupleConstructor();}
|
57 |
|
|
static TupleConstructor* createCopy(const TupleConstructor& toCopy) {return new TupleConstructor(toCopy);}
|
58 |
|
|
public:
|
59 |
|
|
friend class Ast;
|
60 |
|
|
friend class Expression;
|
61 |
|
|
|
62 |
|
|
void init(std::int32_t line, std::int32_t pos,
|
63 |
|
|
Type* typeRef,IdentifierList* callTargetsIdentifierListRef, SymbolTable* symbTabRef,
|
64 |
|
|
ExpressionList* exprList, Identifier* tupleTypeId, bool isMatcher)
|
65 |
|
|
{
|
66 |
|
|
TypeConstructionExpression::init(line,pos,typeRef,callTargetsIdentifierListRef, symbTabRef);
|
67 |
|
|
m_values = std::move(*exprList);
|
68 |
|
|
m_tupleType = tupleTypeId,
|
69 |
|
|
m_matcher = isMatcher;
|
70 |
|
|
}
|
71 |
|
|
|
72 |
|
|
ExpressionList& values() {return m_values;}
|
73 |
|
|
Identifier* tupleType() {return m_tupleType;};
|
74 |
|
|
bool isMatcher() {return m_matcher;}
|
75 |
|
|
|
76 |
|
|
void setIsMatcher(bool newVal) {m_matcher = newVal;};
|
77 |
|
|
void accept(IAstVisitor& visitor) override {visitor.visit(this);};
|
78 |
|
|
|
79 |
|
|
};
|
80 |
|
|
} |