mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-13 15:41:50 +01:00
First merge of 2.064 beta.
This corresponds to DMD commit a913ce4bc59a94a022a27e390fc841f4aededffb. Doesn't build Phobos yet.
This commit is contained in:
committed by
Kai Nacke
parent
c400d180d2
commit
cb341586e3
55
dmd2/enum.h
55
dmd2/enum.h
@@ -1,6 +1,6 @@
|
||||
|
||||
// Compiler implementation of the D programming language
|
||||
// Copyright (c) 1999-2008 by Digital Mars
|
||||
// Copyright (c) 1999-2013 by Digital Mars
|
||||
// All Rights Reserved
|
||||
// written by Walter Bright
|
||||
// http://www.digitalmars.com
|
||||
@@ -18,39 +18,42 @@
|
||||
#include "root.h"
|
||||
#include "dsymbol.h"
|
||||
|
||||
struct Identifier;
|
||||
struct Type;
|
||||
struct Expression;
|
||||
class Identifier;
|
||||
class Type;
|
||||
class Expression;
|
||||
struct HdrGenState;
|
||||
struct VarDeclaration;
|
||||
class VarDeclaration;
|
||||
|
||||
struct EnumDeclaration : ScopeDsymbol
|
||||
{ /* enum ident : memtype { ... }
|
||||
class EnumDeclaration : public ScopeDsymbol
|
||||
{
|
||||
public:
|
||||
/* The separate, and distinct, cases are:
|
||||
* 1. enum { ... }
|
||||
* 2. enum : memtype { ... }
|
||||
* 3. enum id { ... }
|
||||
* 4. enum id : memtype { ... }
|
||||
* 5. enum id : memtype;
|
||||
* 6. enum id;
|
||||
*/
|
||||
Type *type; // the TypeEnum
|
||||
Type *memtype; // type of the members
|
||||
enum PROT protection;
|
||||
PROT protection;
|
||||
|
||||
#if DMDV1
|
||||
dinteger_t maxval;
|
||||
dinteger_t minval;
|
||||
dinteger_t defaultval; // default initializer
|
||||
#else
|
||||
private:
|
||||
Expression *maxval;
|
||||
Expression *minval;
|
||||
Expression *defaultval; // default initializer
|
||||
#endif
|
||||
|
||||
public:
|
||||
bool isdeprecated;
|
||||
int isdone; // 0: not done
|
||||
// 1: semantic() successfully completed
|
||||
bool added;
|
||||
|
||||
EnumDeclaration(Loc loc, Identifier *id, Type *memtype);
|
||||
Dsymbol *syntaxCopy(Dsymbol *s);
|
||||
int addMember(Scope *sc, ScopeDsymbol *sd, int memnum);
|
||||
void setScope(Scope *sc);
|
||||
void semantic0(Scope *sc);
|
||||
void semantic(Scope *sc);
|
||||
int oneMember(Dsymbol **ps, Identifier *ident = NULL);
|
||||
bool oneMember(Dsymbol **ps, Identifier *ident);
|
||||
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
||||
Type *getType();
|
||||
const char *kind();
|
||||
@@ -58,6 +61,10 @@ struct EnumDeclaration : ScopeDsymbol
|
||||
Dsymbol *search(Loc, Identifier *ident, int flags);
|
||||
#endif
|
||||
bool isDeprecated(); // is Dsymbol deprecated?
|
||||
PROT prot();
|
||||
Expression *getMaxMinValue(Loc loc, Identifier *id);
|
||||
Expression *getDefaultValue(Loc loc);
|
||||
Type *getMemtype(Loc loc);
|
||||
|
||||
void emitComment(Scope *sc);
|
||||
void toJson(JsonOut *json);
|
||||
@@ -66,7 +73,6 @@ struct EnumDeclaration : ScopeDsymbol
|
||||
EnumDeclaration *isEnumDeclaration() { return this; }
|
||||
|
||||
#if IN_DMD
|
||||
bool objFileDone; // if toObjFile was already called
|
||||
void toObjFile(int multiobj); // compile to .obj file
|
||||
void toDebug();
|
||||
int cvMember(unsigned char *p);
|
||||
@@ -81,11 +87,18 @@ struct EnumDeclaration : ScopeDsymbol
|
||||
};
|
||||
|
||||
|
||||
struct EnumMember : Dsymbol
|
||||
class EnumMember : public Dsymbol
|
||||
{
|
||||
EnumDeclaration *ed;
|
||||
public:
|
||||
/* Can take the following forms:
|
||||
* 1. id
|
||||
* 2. id = value
|
||||
* 3. type id = value
|
||||
*/
|
||||
Expression *value;
|
||||
Type *type;
|
||||
|
||||
EnumDeclaration *ed;
|
||||
VarDeclaration *vd;
|
||||
|
||||
EnumMember(Loc loc, Identifier *id, Expression *value, Type *type);
|
||||
|
||||
Reference in New Issue
Block a user