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/LeafExpression.hpp>
|
29 |
|
|
#include <ast/identifiers/Identifier.hpp>
|
30 |
|
|
|
31 |
|
|
namespace Ast {
|
32 |
|
|
|
33 |
|
|
class IdentifierExpression
|
34 |
|
|
: public LeafExpression
|
35 |
|
|
{
|
36 |
|
|
protected:
|
37 |
|
|
bool m_self;
|
38 |
|
|
Identifier* m_identifier;
|
39 |
|
|
|
40 |
|
|
IdentifierExpression():
|
41 |
|
|
LeafExpression(LeafTypeEnum::identifier, ExpressionKind::Identifier),
|
42 |
|
|
m_self (false),
|
43 |
|
|
m_identifier (nullptr)
|
44 |
|
|
{};
|
45 |
|
|
IdentifierExpression(const IdentifierExpression &toCopy):
|
46 |
|
|
LeafExpression(toCopy),
|
47 |
|
|
m_self (toCopy.m_self),
|
48 |
|
|
m_identifier (toCopy.m_identifier)
|
49 |
|
|
{};
|
50 |
|
|
|
51 |
|
|
static IdentifierExpression* create(ExpressionKind){return new IdentifierExpression();}
|
52 |
|
|
static IdentifierExpression* createCopy(const IdentifierExpression& toCopy) {return new IdentifierExpression(toCopy);}
|
53 |
|
|
public:
|
54 |
|
|
friend class Ast;
|
55 |
|
|
friend class Expression;
|
56 |
|
|
|
57 |
|
|
void init(std::int32_t line, std::int32_t pos,
|
58 |
|
|
Type* typeRef,IdentifierList* callTargetsIdentifierListRef,
|
59 |
|
|
SymbolTable* symbTabRef, Identifier* identifierRef, bool isSelf)
|
60 |
|
|
{
|
61 |
|
|
LeafExpression::init(line,pos,typeRef,callTargetsIdentifierListRef, symbTabRef);
|
62 |
|
|
m_identifier = identifierRef;
|
63 |
|
|
m_self = isSelf;
|
64 |
|
|
}
|
65 |
|
|
|
66 |
|
|
Identifier* identifier() {return m_identifier;};
|
67 |
|
|
bool isSelf() const {return m_self;};
|
68 |
|
|
void setIsSelf(bool newValue) {m_self = newValue;};
|
69 |
|
|
void accept(IAstVisitor& visitor) override {visitor.visit(this);};
|
70 |
|
|
void setIdentifier(Identifier* newIdentifier) {m_identifier = newIdentifier;};
|
71 |
|
|
};
|
72 |
|
|
} |