| 1 |
// Compiler implementation of the D programming language |
|---|
| 2 |
// Copyright (c) 1999-2007 by Digital Mars |
|---|
| 3 |
// All Rights Reserved |
|---|
| 4 |
// written by Walter Bright |
|---|
| 5 |
// http://www.digitalmars.com |
|---|
| 6 |
// License for redistribution is by either the Artistic License |
|---|
| 7 |
// in artistic.txt, or the GNU General Public License in gnu.txt. |
|---|
| 8 |
// See the included readme.txt for details. |
|---|
| 9 |
|
|---|
| 10 |
#ifndef DMD_ATTRIB_H |
|---|
| 11 |
#define DMD_ATTRIB_H |
|---|
| 12 |
|
|---|
| 13 |
#ifdef __DMC__ |
|---|
| 14 |
#pragma once |
|---|
| 15 |
#endif /* __DMC__ */ |
|---|
| 16 |
|
|---|
| 17 |
#include "dsymbol.h" |
|---|
| 18 |
|
|---|
| 19 |
struct Expression; |
|---|
| 20 |
struct Statement; |
|---|
| 21 |
struct LabelDsymbol; |
|---|
| 22 |
struct Initializer; |
|---|
| 23 |
struct Module; |
|---|
| 24 |
struct Condition; |
|---|
| 25 |
#ifdef _DH |
|---|
| 26 |
struct HdrGenState; |
|---|
| 27 |
#endif |
|---|
| 28 |
|
|---|
| 29 |
/**************************************************************/ |
|---|
| 30 |
|
|---|
| 31 |
struct AttribDeclaration : Dsymbol |
|---|
| 32 |
{ |
|---|
| 33 |
Array *decl; // array of Dsymbol's |
|---|
| 34 |
|
|---|
| 35 |
AttribDeclaration(Array *decl); |
|---|
| 36 |
virtual Array *include(Scope *sc, ScopeDsymbol *s); |
|---|
| 37 |
int addMember(Scope *sc, ScopeDsymbol *s, int memnum); |
|---|
| 38 |
void semantic(Scope *sc); |
|---|
| 39 |
void semantic2(Scope *sc); |
|---|
| 40 |
void semantic3(Scope *sc); |
|---|
| 41 |
void inlineScan(); |
|---|
| 42 |
void addComment(unsigned char *comment); |
|---|
| 43 |
void emitComment(Scope *sc); |
|---|
| 44 |
const char *kind(); |
|---|
| 45 |
int oneMember(Dsymbol **ps); |
|---|
| 46 |
int hasPointers(); |
|---|
| 47 |
void checkCtorConstInit(); |
|---|
| 48 |
void addLocalClass(ClassDeclarations *); |
|---|
| 49 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 50 |
AttribDeclaration *isAttribDeclaration() { return this; } |
|---|
| 51 |
}; |
|---|
| 52 |
|
|---|
| 53 |
struct StorageClassDeclaration: AttribDeclaration |
|---|
| 54 |
{ |
|---|
| 55 |
unsigned stc; |
|---|
| 56 |
|
|---|
| 57 |
StorageClassDeclaration(unsigned stc, Array *decl); |
|---|
| 58 |
Dsymbol *syntaxCopy(Dsymbol *s); |
|---|
| 59 |
void semantic(Scope *sc); |
|---|
| 60 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 61 |
}; |
|---|
| 62 |
|
|---|
| 63 |
struct LinkDeclaration : AttribDeclaration |
|---|
| 64 |
{ |
|---|
| 65 |
enum LINK linkage; |
|---|
| 66 |
|
|---|
| 67 |
LinkDeclaration(enum LINK p, Array *decl); |
|---|
| 68 |
Dsymbol *syntaxCopy(Dsymbol *s); |
|---|
| 69 |
void semantic(Scope *sc); |
|---|
| 70 |
void semantic3(Scope *sc); |
|---|
| 71 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 72 |
char *toChars(); |
|---|
| 73 |
}; |
|---|
| 74 |
|
|---|
| 75 |
struct ProtDeclaration : AttribDeclaration |
|---|
| 76 |
{ |
|---|
| 77 |
enum PROT protection; |
|---|
| 78 |
|
|---|
| 79 |
ProtDeclaration(enum PROT p, Array *decl); |
|---|
| 80 |
Dsymbol *syntaxCopy(Dsymbol *s); |
|---|
| 81 |
void semantic(Scope *sc); |
|---|
| 82 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 83 |
}; |
|---|
| 84 |
|
|---|
| 85 |
struct AlignDeclaration : AttribDeclaration |
|---|
| 86 |
{ |
|---|
| 87 |
unsigned salign; |
|---|
| 88 |
|
|---|
| 89 |
AlignDeclaration(unsigned sa, Array *decl); |
|---|
| 90 |
Dsymbol *syntaxCopy(Dsymbol *s); |
|---|
| 91 |
void semantic(Scope *sc); |
|---|
| 92 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 93 |
}; |
|---|
| 94 |
|
|---|
| 95 |
struct AnonDeclaration : AttribDeclaration |
|---|
| 96 |
{ |
|---|
| 97 |
int isunion; |
|---|
| 98 |
Scope *scope; // !=NULL means context to use |
|---|
| 99 |
int sem; // 1 if successful semantic() |
|---|
| 100 |
|
|---|
| 101 |
AnonDeclaration(Loc loc, int isunion, Array *decl); |
|---|
| 102 |
Dsymbol *syntaxCopy(Dsymbol *s); |
|---|
| 103 |
void semantic(Scope *sc); |
|---|
| 104 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 105 |
const char *kind(); |
|---|
| 106 |
}; |
|---|
| 107 |
|
|---|
| 108 |
struct PragmaDeclaration : AttribDeclaration |
|---|
| 109 |
{ |
|---|
| 110 |
Expressions *args; // array of Expression's |
|---|
| 111 |
|
|---|
| 112 |
PragmaDeclaration(Loc loc, Identifier *ident, Expressions *args, Array *decl); |
|---|
| 113 |
Dsymbol *syntaxCopy(Dsymbol *s); |
|---|
| 114 |
void semantic(Scope *sc); |
|---|
| 115 |
int oneMember(Dsymbol **ps); |
|---|
| 116 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 117 |
const char *kind(); |
|---|
| 118 |
}; |
|---|
| 119 |
|
|---|
| 120 |
struct ConditionalDeclaration : AttribDeclaration |
|---|
| 121 |
{ |
|---|
| 122 |
Condition *condition; |
|---|
| 123 |
Array *elsedecl; // array of Dsymbol's for else block |
|---|
| 124 |
|
|---|
| 125 |
ConditionalDeclaration(Condition *condition, Array *decl, Array *elsedecl); |
|---|
| 126 |
Dsymbol *syntaxCopy(Dsymbol *s); |
|---|
| 127 |
int oneMember(Dsymbol **ps); |
|---|
| 128 |
void emitComment(Scope *sc); |
|---|
| 129 |
Array *include(Scope *sc, ScopeDsymbol *s); |
|---|
| 130 |
void addComment(unsigned char *comment); |
|---|
| 131 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 132 |
}; |
|---|
| 133 |
|
|---|
| 134 |
struct StaticIfDeclaration : ConditionalDeclaration |
|---|
| 135 |
{ |
|---|
| 136 |
ScopeDsymbol *sd; |
|---|
| 137 |
int addisdone; |
|---|
| 138 |
|
|---|
| 139 |
StaticIfDeclaration(Condition *condition, Array *decl, Array *elsedecl); |
|---|
| 140 |
Dsymbol *syntaxCopy(Dsymbol *s); |
|---|
| 141 |
int addMember(Scope *sc, ScopeDsymbol *s, int memnum); |
|---|
| 142 |
void semantic(Scope *sc); |
|---|
| 143 |
const char *kind(); |
|---|
| 144 |
}; |
|---|
| 145 |
|
|---|
| 146 |
// Mixin declarations |
|---|
| 147 |
|
|---|
| 148 |
struct CompileDeclaration : AttribDeclaration |
|---|
| 149 |
{ |
|---|
| 150 |
Expression *exp; |
|---|
| 151 |
|
|---|
| 152 |
ScopeDsymbol *sd; |
|---|
| 153 |
int compiled; |
|---|
| 154 |
|
|---|
| 155 |
CompileDeclaration(Loc loc, Expression *exp); |
|---|
| 156 |
Dsymbol *syntaxCopy(Dsymbol *s); |
|---|
| 157 |
int addMember(Scope *sc, ScopeDsymbol *sd, int memnum); |
|---|
| 158 |
void compileIt(Scope *sc); |
|---|
| 159 |
void semantic(Scope *sc); |
|---|
| 160 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 161 |
}; |
|---|
| 162 |
|
|---|
| 163 |
#endif /* DMD_ATTRIB_H */ |
|---|