-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypes.h
More file actions
94 lines (68 loc) · 1.49 KB
/
Copy pathTypes.h
File metadata and controls
94 lines (68 loc) · 1.49 KB
1
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#if !defined(__TYPE_H__)
#define __TYPE_H__
#include "Base.h"
#include <set>
// The base class for types
class TyType: public Base {
public:
virtual string toString() = 0;
};
// The type for an expression that we haven't yet resolved
class TyUnresolvedType : public TyType {
public:
virtual string toString();
};
// A null - not used during parsing, only typechecking.
class TyNull : public TyType {
public:
virtual string toString();
};
// An int
class TyInt : public TyType {
public:
virtual string toString();
};
// A double
class TyDouble : public TyType {
public:
virtual string toString();
};
// A bool
class TyBool : public TyType {
public:
virtual string toString();
};
// A string
class TyString : public TyType {
public:
virtual string toString();
};
// A void (only used for function return types)
class TyVoid : public TyType {
public:
virtual string toString();
};
class TyNamedType : public TyUnresolvedType {
};
// A type name. Either a class or an interface
class TyName : public TyNamedType {
public:
TyName(string name) : Name(name) {};
virtual string toString();
string Name;
};
// An array type
class TyArray : public TyUnresolvedType {
public:
TyArray(TyType* type) : Type(type) {};
virtual string toString();
virtual bool hasPointerTo(Base *base, set<Base *> *seen);
TyType* Type;
};
// An unknown type
class TyUnknown : public TyType {
public:
virtual string toString();
};
ostream& operator << (ostream& stream, TyType* type);
#endif