Files
BlitzNext/compiler/decl.hpp
T

42 lines
720 B
C++
Raw Normal View History

2014-01-31 08:23:00 +13:00
#ifndef DECL_H
#define DECL_H
2019-01-18 17:04:57 +01:00
enum {
DECL_FUNC = 1,
DECL_ARRAY = 2,
DECL_STRUCT = 4, //NOT vars
DECL_GLOBAL = 8,
DECL_LOCAL = 16,
DECL_PARAM = 32,
DECL_FIELD = 64 //ARE vars
2014-01-31 08:23:00 +13:00
};
struct Type;
struct ConstType;
2019-01-18 17:04:57 +01:00
struct Decl {
string name;
Type* type; //type
int kind, offset;
ConstType* defType; //default value
Decl(const string& s, Type* t, int k, ConstType* d = 0) : name(s), type(t), kind(k), defType(d) {}
2014-01-31 08:23:00 +13:00
~Decl();
2019-01-18 17:04:57 +01:00
virtual void getName(char* buff);
2014-01-31 08:23:00 +13:00
};
2019-01-18 17:04:57 +01:00
struct DeclSeq {
2014-01-31 08:23:00 +13:00
vector<Decl*> decls;
DeclSeq();
~DeclSeq();
2019-01-18 17:04:57 +01:00
Decl* findDecl(const string& s);
Decl* insertDecl(const string& s, Type* t, int kind, ConstType* d = 0);
int size()
{
return decls.size();
}
2014-01-31 08:23:00 +13:00
};
#endif