1 |
2
|
krennw
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
#pragma once
|
27 |
|
|
|
28 |
|
|
#include <ast/identifiers/ValueReferenceIdentifier.hpp>
|
29 |
|
|
#include <ast/expressions/Expression.hpp>
|
30 |
|
|
|
31 |
|
|
namespace Ast {
|
32 |
|
|
|
33 |
|
|
class AttributeIdentifier final
|
34 |
|
|
: public ValueReferenceIdentifier
|
35 |
|
|
{
|
36 |
|
|
protected:
|
37 |
|
|
bool m_isStatic;
|
38 |
|
|
bool m_isObservable;
|
39 |
|
|
bool m_isControllable;
|
40 |
|
|
Expression* m_initializer;
|
41 |
|
|
|
42 |
|
|
AttributeIdentifier():
|
43 |
|
|
ValueReferenceIdentifier(IdentifierKind::AttributeIdentifier),
|
44 |
|
|
m_isStatic (false),
|
45 |
|
|
m_isObservable (false),
|
46 |
|
|
m_isControllable (false),
|
47 |
|
|
m_initializer (nullptr)
|
48 |
|
|
{}
|
49 |
|
|
|
50 |
|
|
AttributeIdentifier(const AttributeIdentifier& toCopy) :
|
51 |
|
|
ValueReferenceIdentifier(toCopy),
|
52 |
|
|
m_isStatic (toCopy.m_isStatic),
|
53 |
|
|
m_isObservable (toCopy.m_isObservable),
|
54 |
|
|
m_isControllable (toCopy.m_isControllable),
|
55 |
|
|
m_initializer (toCopy.m_initializer)
|
56 |
|
|
{}
|
57 |
|
|
|
58 |
|
|
static AttributeIdentifier* create() {return new AttributeIdentifier();}
|
59 |
|
|
static AttributeIdentifier* createCopy(const AttributeIdentifier& toCopy) {return new AttributeIdentifier(toCopy);}
|
60 |
|
|
public:
|
61 |
|
|
friend class Ast;
|
62 |
|
|
friend class Identifier;
|
63 |
|
|
|
64 |
|
|
void init (std::int32_t line, std::int32_t col, const char* text,
|
65 |
|
|
IScope* scopeRef, Type* typeRef, Expression* initRef,
|
66 |
|
|
bool isStatic, bool isControllable, bool isObservable)
|
67 |
|
|
{
|
68 |
|
|
ValueReferenceIdentifier::init(line,col,text,scopeRef,typeRef);
|
69 |
|
|
m_initializer = initRef;
|
70 |
|
|
m_isStatic = isStatic;
|
71 |
|
|
m_isControllable = isControllable;
|
72 |
|
|
m_isObservable = isObservable;
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
Expression* initializer() const { return m_initializer; };
|
76 |
|
|
bool isStatic() const { return m_isStatic; };
|
77 |
|
|
bool isObservable() const { return m_isObservable; };
|
78 |
|
|
bool isControllable() const { return m_isControllable; };
|
79 |
|
|
|
80 |
|
|
void accept(IAstVisitor& visitor) override { visitor.visit(this); };
|
81 |
|
|
void setInitializer(Expression* newExpr) { m_initializer = newExpr; };
|
82 |
|
|
};
|
83 |
|
|
|
84 |
|
|
} |