| 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_DECLARATION_H |
|---|
| 11 |
#define DMD_DECLARATION_H |
|---|
| 12 |
|
|---|
| 13 |
#ifdef __DMC__ |
|---|
| 14 |
#pragma once |
|---|
| 15 |
#endif /* __DMC__ */ |
|---|
| 16 |
|
|---|
| 17 |
#include "dsymbol.h" |
|---|
| 18 |
#include "lexer.h" |
|---|
| 19 |
#include "mtype.h" |
|---|
| 20 |
|
|---|
| 21 |
struct Expression; |
|---|
| 22 |
struct Statement; |
|---|
| 23 |
struct LabelDsymbol; |
|---|
| 24 |
struct Initializer; |
|---|
| 25 |
struct Module; |
|---|
| 26 |
struct InlineScanState; |
|---|
| 27 |
struct ForeachStatement; |
|---|
| 28 |
struct FuncDeclaration; |
|---|
| 29 |
struct ExpInitializer; |
|---|
| 30 |
struct StructDeclaration; |
|---|
| 31 |
struct TupleType; |
|---|
| 32 |
struct InterState; |
|---|
| 33 |
|
|---|
| 34 |
enum PROT; |
|---|
| 35 |
enum LINK; |
|---|
| 36 |
enum TOK; |
|---|
| 37 |
enum MATCH; |
|---|
| 38 |
|
|---|
| 39 |
enum STC |
|---|
| 40 |
{ |
|---|
| 41 |
STCundefined = 0, |
|---|
| 42 |
STCstatic = 1, |
|---|
| 43 |
STCextern = 2, |
|---|
| 44 |
STCconst = 4, |
|---|
| 45 |
STCfinal = 8, |
|---|
| 46 |
STCabstract = 0x10, |
|---|
| 47 |
STCparameter = 0x20, |
|---|
| 48 |
STCfield = 0x40, |
|---|
| 49 |
STCoverride = 0x80, |
|---|
| 50 |
STCauto = 0x100, |
|---|
| 51 |
STCsynchronized = 0x200, |
|---|
| 52 |
STCdeprecated = 0x400, |
|---|
| 53 |
STCin = 0x800, // in parameter |
|---|
| 54 |
STCout = 0x1000, // out parameter |
|---|
| 55 |
STClazy = 0x2000, // lazy parameter |
|---|
| 56 |
STCforeach = 0x4000, // variable for foreach loop |
|---|
| 57 |
STCcomdat = 0x8000, // should go into COMDAT record |
|---|
| 58 |
STCvariadic = 0x10000, // variadic function argument |
|---|
| 59 |
STCctorinit = 0x20000, // can only be set inside constructor |
|---|
| 60 |
STCtemplateparameter = 0x40000, // template parameter |
|---|
| 61 |
STCscope = 0x80000, // template parameter |
|---|
| 62 |
STCinvariant = 0x100000, |
|---|
| 63 |
STCref = 0x200000, |
|---|
| 64 |
}; |
|---|
| 65 |
|
|---|
| 66 |
struct Match |
|---|
| 67 |
{ |
|---|
| 68 |
int count; // number of matches found |
|---|
| 69 |
MATCH last; // match level of lastf |
|---|
| 70 |
FuncDeclaration *lastf; // last matching function we found |
|---|
| 71 |
FuncDeclaration *nextf; // current matching function |
|---|
| 72 |
FuncDeclaration *anyf; // pick a func, any func, to use for error recovery |
|---|
| 73 |
}; |
|---|
| 74 |
|
|---|
| 75 |
void overloadResolveX(Match *m, FuncDeclaration *f, Expressions *arguments); |
|---|
| 76 |
int overloadApply(FuncDeclaration *fstart, |
|---|
| 77 |
int (*fp)(void *, FuncDeclaration *), |
|---|
| 78 |
void *param); |
|---|
| 79 |
|
|---|
| 80 |
/**************************************************************/ |
|---|
| 81 |
|
|---|
| 82 |
struct Declaration : Dsymbol |
|---|
| 83 |
{ |
|---|
| 84 |
Type *type; |
|---|
| 85 |
unsigned storage_class; |
|---|
| 86 |
enum PROT protection; |
|---|
| 87 |
enum LINK linkage; |
|---|
| 88 |
|
|---|
| 89 |
Declaration(Identifier *id); |
|---|
| 90 |
void semantic(Scope *sc); |
|---|
| 91 |
char *kind(); |
|---|
| 92 |
unsigned size(Loc loc); |
|---|
| 93 |
|
|---|
| 94 |
void emitComment(Scope *sc); |
|---|
| 95 |
void toDocBuffer(OutBuffer *buf); |
|---|
| 96 |
|
|---|
| 97 |
char *mangle(); |
|---|
| 98 |
int isStatic() { return storage_class & STCstatic; } |
|---|
| 99 |
virtual int isStaticConstructor(); |
|---|
| 100 |
virtual int isStaticDestructor(); |
|---|
| 101 |
virtual int isDelete(); |
|---|
| 102 |
virtual int isDataseg(); |
|---|
| 103 |
virtual int isCodeseg(); |
|---|
| 104 |
int isCtorinit() { return storage_class & STCctorinit; } |
|---|
| 105 |
int isFinal() { return storage_class & STCfinal; } |
|---|
| 106 |
int isAbstract() { return storage_class & STCabstract; } |
|---|
| 107 |
int isConst() { return storage_class & STCconst; } |
|---|
| 108 |
int isAuto() { return storage_class & STCauto; } |
|---|
| 109 |
int isScope() { return storage_class & (STCscope | STCauto); } |
|---|
| 110 |
int isSynchronized() { return storage_class & STCsynchronized; } |
|---|
| 111 |
int isParameter() { return storage_class & STCparameter; } |
|---|
| 112 |
int isDeprecated() { return storage_class & STCdeprecated; } |
|---|
| 113 |
int isOverride() { return storage_class & STCoverride; } |
|---|
| 114 |
|
|---|
| 115 |
int isIn() { return storage_class & STCin; } |
|---|
| 116 |
int isOut() { return storage_class & STCout; } |
|---|
| 117 |
int isRef() { return storage_class & STCref; } |
|---|
| 118 |
|
|---|
| 119 |
enum PROT prot(); |
|---|
| 120 |
|
|---|
| 121 |
Declaration *isDeclaration() { return this; } |
|---|
| 122 |
}; |
|---|
| 123 |
|
|---|
| 124 |
/**************************************************************/ |
|---|
| 125 |
|
|---|
| 126 |
struct TupleDeclaration : Declaration |
|---|
| 127 |
{ |
|---|
| 128 |
Objects *objects; |
|---|
| 129 |
int isexp; // 1: expression tuple |
|---|
| 130 |
|
|---|
| 131 |
TypeTuple *tupletype; // !=NULL if this is a type tuple |
|---|
| 132 |
|
|---|
| 133 |
TupleDeclaration(Loc loc, Identifier *ident, Objects *objects); |
|---|
| 134 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 135 |
char *kind(); |
|---|
| 136 |
Type *getType(); |
|---|
| 137 |
int needThis(); |
|---|
| 138 |
|
|---|
| 139 |
TupleDeclaration *isTupleDeclaration() { return this; } |
|---|
| 140 |
}; |
|---|
| 141 |
|
|---|
| 142 |
/**************************************************************/ |
|---|
| 143 |
|
|---|
| 144 |
struct TypedefDeclaration : Declaration |
|---|
| 145 |
{ |
|---|
| 146 |
Type *basetype; |
|---|
| 147 |
Initializer *init; |
|---|
| 148 |
int sem; // 0: semantic() has not been run |
|---|
| 149 |
// 1: semantic() is in progress |
|---|
| 150 |
// 2: semantic() has been run |
|---|
| 151 |
// 3: semantic2() has been run |
|---|
| 152 |
int inuse; // used to detect typedef cycles |
|---|
| 153 |
|
|---|
| 154 |
TypedefDeclaration(Loc loc, Identifier *ident, Type *basetype, Initializer *init); |
|---|
| 155 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 156 |
void semantic(Scope *sc); |
|---|
| 157 |
void semantic2(Scope *sc); |
|---|
| 158 |
char *mangle(); |
|---|
| 159 |
char *kind(); |
|---|
| 160 |
Type *getType(); |
|---|
| 161 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 162 |
#ifdef _DH |
|---|
| 163 |
Type *htype; |
|---|
| 164 |
Type *hbasetype; |
|---|
| 165 |
#endif |
|---|
| 166 |
|
|---|
| 167 |
void toDocBuffer(OutBuffer *buf); |
|---|
| 168 |
|
|---|
| 169 |
void toDebug(); |
|---|
| 170 |
|
|---|
| 171 |
TypedefDeclaration *isTypedefDeclaration() { return this; } |
|---|
| 172 |
|
|---|
| 173 |
Symbol *sinit; |
|---|
| 174 |
}; |
|---|
| 175 |
|
|---|
| 176 |
/**************************************************************/ |
|---|
| 177 |
|
|---|
| 178 |
struct AliasDeclaration : Declaration |
|---|
| 179 |
{ |
|---|
| 180 |
Dsymbol *aliassym; |
|---|
| 181 |
Dsymbol *overnext; // next in overload list |
|---|
| 182 |
int inSemantic; |
|---|
| 183 |
|
|---|
| 184 |
AliasDeclaration(Loc loc, Identifier *ident, Type *type); |
|---|
| 185 |
AliasDeclaration(Loc loc, Identifier *ident, Dsymbol *s); |
|---|
| 186 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 187 |
void semantic(Scope *sc); |
|---|
| 188 |
int overloadInsert(Dsymbol *s); |
|---|
| 189 |
char *kind(); |
|---|
| 190 |
Type *getType(); |
|---|
| 191 |
Dsymbol *toAlias(); |
|---|
| 192 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 193 |
#ifdef _DH |
|---|
| 194 |
Type *htype; |
|---|
| 195 |
Dsymbol *haliassym; |
|---|
| 196 |
#endif |
|---|
| 197 |
|
|---|
| 198 |
void toDocBuffer(OutBuffer *buf); |
|---|
| 199 |
|
|---|
| 200 |
AliasDeclaration *isAliasDeclaration() { return this; } |
|---|
| 201 |
}; |
|---|
| 202 |
|
|---|
| 203 |
/**************************************************************/ |
|---|
| 204 |
|
|---|
| 205 |
struct VarDeclaration : Declaration |
|---|
| 206 |
{ |
|---|
| 207 |
Initializer *init; |
|---|
| 208 |
unsigned offset; |
|---|
| 209 |
int noauto; // no auto semantics |
|---|
| 210 |
int nestedref; // referenced by a lexically nested function |
|---|
| 211 |
int inuse; |
|---|
| 212 |
int ctorinit; // it has been initialized in a ctor |
|---|
| 213 |
int onstack; // 1: it has been allocated on the stack |
|---|
| 214 |
// 2: on stack, run destructor anyway |
|---|
| 215 |
int canassign; // it can be assigned to |
|---|
| 216 |
Dsymbol *aliassym; // if redone as alias to another symbol |
|---|
| 217 |
Expression *value; // when interpreting, this is the value |
|---|
| 218 |
// (NULL if value not determinable) |
|---|
| 219 |
|
|---|
| 220 |
VarDeclaration(Loc loc, Type *t, Identifier *id, Initializer *init); |
|---|
| 221 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 222 |
void semantic(Scope *sc); |
|---|
| 223 |
void semantic2(Scope *sc); |
|---|
| 224 |
char *kind(); |
|---|
| 225 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 226 |
#ifdef _DH |
|---|
| 227 |
Type *htype; |
|---|
| 228 |
Initializer *hinit; |
|---|
| 229 |
#endif |
|---|
| 230 |
int needThis(); |
|---|
| 231 |
int isImportedSymbol(); |
|---|
| 232 |
int isDataseg(); |
|---|
| 233 |
int hasPointers(); |
|---|
| 234 |
Expression *callAutoDtor(); |
|---|
| 235 |
ExpInitializer *getExpInitializer(); |
|---|
| 236 |
void checkCtorConstInit(); |
|---|
| 237 |
void checkNestedReference(Scope *sc, Loc loc); |
|---|
| 238 |
Dsymbol *toAlias(); |
|---|
| 239 |
|
|---|
| 240 |
// Eliminate need for dynamic_cast |
|---|
| 241 |
VarDeclaration *isVarDeclaration() { return (VarDeclaration *)this; } |
|---|
| 242 |
}; |
|---|
| 243 |
|
|---|
| 244 |
/**************************************************************/ |
|---|
| 245 |
|
|---|
| 246 |
// This is a shell around a back end symbol |
|---|
| 247 |
|
|---|
| 248 |
struct SymbolDeclaration : Declaration |
|---|
| 249 |
{ |
|---|
| 250 |
Symbol *sym; |
|---|
| 251 |
StructDeclaration *dsym; |
|---|
| 252 |
|
|---|
| 253 |
SymbolDeclaration(Loc loc, Symbol *s, StructDeclaration *dsym); |
|---|
| 254 |
|
|---|
| 255 |
// Eliminate need for dynamic_cast |
|---|
| 256 |
SymbolDeclaration *isSymbolDeclaration() { return (SymbolDeclaration *)this; } |
|---|
| 257 |
}; |
|---|
| 258 |
|
|---|
| 259 |
struct ClassInfoDeclaration : VarDeclaration |
|---|
| 260 |
{ |
|---|
| 261 |
ClassDeclaration *cd; |
|---|
| 262 |
|
|---|
| 263 |
ClassInfoDeclaration(ClassDeclaration *cd); |
|---|
| 264 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 265 |
void semantic(Scope *sc); |
|---|
| 266 |
|
|---|
| 267 |
void emitComment(Scope *sc); |
|---|
| 268 |
}; |
|---|
| 269 |
|
|---|
| 270 |
struct ModuleInfoDeclaration : VarDeclaration |
|---|
| 271 |
{ |
|---|
| 272 |
Module *mod; |
|---|
| 273 |
|
|---|
| 274 |
ModuleInfoDeclaration(Module *mod); |
|---|
| 275 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 276 |
void semantic(Scope *sc); |
|---|
| 277 |
|
|---|
| 278 |
void emitComment(Scope *sc); |
|---|
| 279 |
}; |
|---|
| 280 |
|
|---|
| 281 |
struct TypeInfoDeclaration : VarDeclaration |
|---|
| 282 |
{ |
|---|
| 283 |
Type *tinfo; |
|---|
| 284 |
|
|---|
| 285 |
TypeInfoDeclaration(Type *tinfo, int internal); |
|---|
| 286 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 287 |
void semantic(Scope *sc); |
|---|
| 288 |
|
|---|
| 289 |
void emitComment(Scope *sc); |
|---|
| 290 |
}; |
|---|
| 291 |
|
|---|
| 292 |
struct TypeInfoStructDeclaration : TypeInfoDeclaration |
|---|
| 293 |
{ |
|---|
| 294 |
TypeInfoStructDeclaration(Type *tinfo); |
|---|
| 295 |
}; |
|---|
| 296 |
|
|---|
| 297 |
struct TypeInfoClassDeclaration : TypeInfoDeclaration |
|---|
| 298 |
{ |
|---|
| 299 |
TypeInfoClassDeclaration(Type *tinfo); |
|---|
| 300 |
}; |
|---|
| 301 |
|
|---|
| 302 |
struct TypeInfoInterfaceDeclaration : TypeInfoDeclaration |
|---|
| 303 |
{ |
|---|
| 304 |
TypeInfoInterfaceDeclaration(Type *tinfo); |
|---|
| 305 |
}; |
|---|
| 306 |
|
|---|
| 307 |
struct TypeInfoTypedefDeclaration : TypeInfoDeclaration |
|---|
| 308 |
{ |
|---|
| 309 |
TypeInfoTypedefDeclaration(Type *tinfo); |
|---|
| 310 |
}; |
|---|
| 311 |
|
|---|
| 312 |
struct TypeInfoPointerDeclaration : TypeInfoDeclaration |
|---|
| 313 |
{ |
|---|
| 314 |
TypeInfoPointerDeclaration(Type *tinfo); |
|---|
| 315 |
}; |
|---|
| 316 |
|
|---|
| 317 |
struct TypeInfoArrayDeclaration : TypeInfoDeclaration |
|---|
| 318 |
{ |
|---|
| 319 |
TypeInfoArrayDeclaration(Type *tinfo); |
|---|
| 320 |
}; |
|---|
| 321 |
|
|---|
| 322 |
struct TypeInfoStaticArrayDeclaration : TypeInfoDeclaration |
|---|
| 323 |
{ |
|---|
| 324 |
TypeInfoStaticArrayDeclaration(Type *tinfo); |
|---|
| 325 |
}; |
|---|
| 326 |
|
|---|
| 327 |
struct TypeInfoAssociativeArrayDeclaration : TypeInfoDeclaration |
|---|
| 328 |
{ |
|---|
| 329 |
TypeInfoAssociativeArrayDeclaration(Type *tinfo); |
|---|
| 330 |
}; |
|---|
| 331 |
|
|---|
| 332 |
struct TypeInfoEnumDeclaration : TypeInfoDeclaration |
|---|
| 333 |
{ |
|---|
| 334 |
TypeInfoEnumDeclaration(Type *tinfo); |
|---|
| 335 |
}; |
|---|
| 336 |
|
|---|
| 337 |
struct TypeInfoFunctionDeclaration : TypeInfoDeclaration |
|---|
| 338 |
{ |
|---|
| 339 |
TypeInfoFunctionDeclaration(Type *tinfo); |
|---|
| 340 |
}; |
|---|
| 341 |
|
|---|
| 342 |
struct TypeInfoDelegateDeclaration : TypeInfoDeclaration |
|---|
| 343 |
{ |
|---|
| 344 |
TypeInfoDelegateDeclaration(Type *tinfo); |
|---|
| 345 |
}; |
|---|
| 346 |
|
|---|
| 347 |
struct TypeInfoTupleDeclaration : TypeInfoDeclaration |
|---|
| 348 |
{ |
|---|
| 349 |
TypeInfoTupleDeclaration(Type *tinfo); |
|---|
| 350 |
}; |
|---|
| 351 |
|
|---|
| 352 |
struct ThisDeclaration : VarDeclaration |
|---|
| 353 |
{ |
|---|
| 354 |
ThisDeclaration(Type *t); |
|---|
| 355 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 356 |
}; |
|---|
| 357 |
|
|---|
| 358 |
enum ILS |
|---|
| 359 |
{ |
|---|
| 360 |
ILSuninitialized, // not computed yet |
|---|
| 361 |
ILSno, // cannot inline |
|---|
| 362 |
ILSyes, // can inline |
|---|
| 363 |
}; |
|---|
| 364 |
|
|---|
| 365 |
/**************************************************************/ |
|---|
| 366 |
|
|---|
| 367 |
struct FuncDeclaration : Declaration |
|---|
| 368 |
{ |
|---|
| 369 |
Array *fthrows; // Array of Type's of exceptions (not used) |
|---|
| 370 |
Statement *frequire; |
|---|
| 371 |
Statement *fensure; |
|---|
| 372 |
Statement *fbody; |
|---|
| 373 |
|
|---|
| 374 |
Identifier *outId; // identifier for out statement |
|---|
| 375 |
VarDeclaration *vresult; // variable corresponding to outId |
|---|
| 376 |
LabelDsymbol *returnLabel; // where the return goes |
|---|
| 377 |
|
|---|
| 378 |
DsymbolTable *localsymtab; // used to prevent symbols in different |
|---|
| 379 |
// scopes from having the same name |
|---|
| 380 |
VarDeclaration *vthis; // 'this' parameter (member and nested) |
|---|
| 381 |
VarDeclaration *v_arguments; // '_arguments' parameter |
|---|
| 382 |
#if IN_GCC |
|---|
| 383 |
VarDeclaration *v_argptr; // '_argptr' variable |
|---|
| 384 |
#endif |
|---|
| 385 |
Dsymbols *parameters; // Array of VarDeclaration's for parameters |
|---|
| 386 |
DsymbolTable *labtab; // statement label symbol table |
|---|
| 387 |
Declaration *overnext; // next in overload list |
|---|
| 388 |
Loc endloc; // location of closing curly bracket |
|---|
| 389 |
int vtblIndex; // for member functions, index into vtbl[] |
|---|
| 390 |
int naked; // !=0 if naked |
|---|
| 391 |
int inlineAsm; // !=0 if has inline assembler |
|---|
| 392 |
ILS inlineStatus; |
|---|
| 393 |
int inlineNest; // !=0 if nested inline |
|---|
| 394 |
int cantInterpret; // !=0 if cannot interpret function |
|---|
| 395 |
int semanticRun; // !=0 if semantic3() had been run |
|---|
| 396 |
int nestedFrameRef; // !=0 if nested variables referenced frame ptr |
|---|
| 397 |
ForeachStatement *fes; // if foreach body, this is the foreach |
|---|
| 398 |
int introducing; // !=0 if 'introducing' function |
|---|
| 399 |
Type *tintro; // if !=NULL, then this is the type |
|---|
| 400 |
// of the 'introducing' function |
|---|
| 401 |
// this one is overriding |
|---|
| 402 |
int inferRetType; // !=0 if return type is to be inferred |
|---|
| 403 |
Scope *scope; // !=NULL means context to use |
|---|
| 404 |
|
|---|
| 405 |
// Things that should really go into Scope |
|---|
| 406 |
int hasReturnExp; // 1 if there's a return exp; statement |
|---|
| 407 |
// 2 if there's a throw statement |
|---|
| 408 |
// 4 if there's an assert(0) |
|---|
| 409 |
// 8 if there's inline asm |
|---|
| 410 |
|
|---|
| 411 |
// Support for NRVO (named return value optimization) |
|---|
| 412 |
int nrvo_can; // !=0 means we can do it |
|---|
| 413 |
VarDeclaration *nrvo_var; // variable to replace with shidden |
|---|
| 414 |
Symbol *shidden; // hidden pointer passed to function |
|---|
| 415 |
|
|---|
| 416 |
FuncDeclaration(Loc loc, Loc endloc, Identifier *id, enum STC storage_class, Type *type); |
|---|
| 417 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 418 |
void semantic(Scope *sc); |
|---|
| 419 |
void semantic2(Scope *sc); |
|---|
| 420 |
void semantic3(Scope *sc); |
|---|
| 421 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 422 |
void bodyToCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 423 |
int overrides(FuncDeclaration *fd); |
|---|
| 424 |
int overloadInsert(Dsymbol *s); |
|---|
| 425 |
FuncDeclaration *overloadExactMatch(Type *t); |
|---|
| 426 |
FuncDeclaration *overloadResolve(Loc loc, Expressions *arguments); |
|---|
| 427 |
LabelDsymbol *searchLabel(Identifier *ident); |
|---|
| 428 |
AggregateDeclaration *isThis(); |
|---|
| 429 |
AggregateDeclaration *isMember2(); |
|---|
| 430 |
int getLevel(Loc loc, FuncDeclaration *fd); // lexical nesting level difference |
|---|
| 431 |
void appendExp(Expression *e); |
|---|
| 432 |
void appendState(Statement *s); |
|---|
| 433 |
char *mangle(); |
|---|
| 434 |
int isMain(); |
|---|
| 435 |
int isWinMain(); |
|---|
| 436 |
int isDllMain(); |
|---|
| 437 |
int isExport(); |
|---|
| 438 |
int isImportedSymbol(); |
|---|
| 439 |
int isAbstract(); |
|---|
| 440 |
int isCodeseg(); |
|---|
| 441 |
virtual int isNested(); |
|---|
| 442 |
int needThis(); |
|---|
| 443 |
virtual int isVirtual(); |
|---|
| 444 |
virtual int addPreInvariant(); |
|---|
| 445 |
virtual int addPostInvariant(); |
|---|
| 446 |
Expression *interpret(InterState *istate, Expressions *arguments); |
|---|
| 447 |
void inlineScan(); |
|---|
| 448 |
int canInline(int hasthis, int hdrscan = 0); |
|---|
| 449 |
Expression *doInline(InlineScanState *iss, Expression *ethis, Array *arguments); |
|---|
| 450 |
char *kind(); |
|---|
| 451 |
void toDocBuffer(OutBuffer *buf); |
|---|
| 452 |
|
|---|
| 453 |
static FuncDeclaration *genCfunc(Type *treturn, char *name); |
|---|
| 454 |
static FuncDeclaration *genCfunc(Type *treturn, Identifier *id); |
|---|
| 455 |
|
|---|
| 456 |
Symbol *toThunkSymbol(int offset); // thunk version |
|---|
| 457 |
|
|---|
| 458 |
FuncDeclaration *isFuncDeclaration() { return this; } |
|---|
| 459 |
}; |
|---|
| 460 |
|
|---|
| 461 |
struct FuncAliasDeclaration : FuncDeclaration |
|---|
| 462 |
{ |
|---|
| 463 |
FuncDeclaration *funcalias; |
|---|
| 464 |
|
|---|
| 465 |
FuncAliasDeclaration(FuncDeclaration *funcalias); |
|---|
| 466 |
|
|---|
| 467 |
FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } |
|---|
| 468 |
char *kind(); |
|---|
| 469 |
Symbol *toSymbol(); |
|---|
| 470 |
}; |
|---|
| 471 |
|
|---|
| 472 |
struct FuncLiteralDeclaration : FuncDeclaration |
|---|
| 473 |
{ |
|---|
| 474 |
enum TOK tok; // TOKfunction or TOKdelegate |
|---|
| 475 |
|
|---|
| 476 |
FuncLiteralDeclaration(Loc loc, Loc endloc, Type *type, enum TOK tok, |
|---|
| 477 |
ForeachStatement *fes); |
|---|
| 478 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 479 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 480 |
int isNested(); |
|---|
| 481 |
|
|---|
| 482 |
FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; } |
|---|
| 483 |
char *kind(); |
|---|
| 484 |
}; |
|---|
| 485 |
|
|---|
| 486 |
struct CtorDeclaration : FuncDeclaration |
|---|
| 487 |
{ Arguments *arguments; |
|---|
| 488 |
int varargs; |
|---|
| 489 |
|
|---|
| 490 |
CtorDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); |
|---|
| 491 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 492 |
void semantic(Scope *sc); |
|---|
| 493 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 494 |
char *kind(); |
|---|
| 495 |
char *toChars(); |
|---|
| 496 |
int isVirtual(); |
|---|
| 497 |
int addPreInvariant(); |
|---|
| 498 |
int addPostInvariant(); |
|---|
| 499 |
void toDocBuffer(OutBuffer *buf); |
|---|
| 500 |
|
|---|
| 501 |
CtorDeclaration *isCtorDeclaration() { return this; } |
|---|
| 502 |
}; |
|---|
| 503 |
|
|---|
| 504 |
struct DtorDeclaration : FuncDeclaration |
|---|
| 505 |
{ |
|---|
| 506 |
DtorDeclaration(Loc loc, Loc endloc); |
|---|
| 507 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 508 |
void semantic(Scope *sc); |
|---|
| 509 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 510 |
int isVirtual(); |
|---|
| 511 |
int addPreInvariant(); |
|---|
| 512 |
int addPostInvariant(); |
|---|
| 513 |
int overloadInsert(Dsymbol *s); |
|---|
| 514 |
void emitComment(Scope *sc); |
|---|
| 515 |
|
|---|
| 516 |
DtorDeclaration *isDtorDeclaration() { return this; } |
|---|
| 517 |
}; |
|---|
| 518 |
|
|---|
| 519 |
struct StaticCtorDeclaration : FuncDeclaration |
|---|
| 520 |
{ |
|---|
| 521 |
StaticCtorDeclaration(Loc loc, Loc endloc); |
|---|
| 522 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 523 |
void semantic(Scope *sc); |
|---|
| 524 |
AggregateDeclaration *isThis(); |
|---|
| 525 |
int isStaticConstructor(); |
|---|
| 526 |
int isVirtual(); |
|---|
| 527 |
int addPreInvariant(); |
|---|
| 528 |
int addPostInvariant(); |
|---|
| 529 |
void emitComment(Scope *sc); |
|---|
| 530 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 531 |
|
|---|
| 532 |
StaticCtorDeclaration *isStaticCtorDeclaration() { return this; } |
|---|
| 533 |
}; |
|---|
| 534 |
|
|---|
| 535 |
struct StaticDtorDeclaration : FuncDeclaration |
|---|
| 536 |
{ |
|---|
| 537 |
StaticDtorDeclaration(Loc loc, Loc endloc); |
|---|
| 538 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 539 |
void semantic(Scope *sc); |
|---|
| 540 |
AggregateDeclaration *isThis(); |
|---|
| 541 |
int isStaticDestructor(); |
|---|
| 542 |
int isVirtual(); |
|---|
| 543 |
int addPreInvariant(); |
|---|
| 544 |
int addPostInvariant(); |
|---|
| 545 |
void emitComment(Scope *sc); |
|---|
| 546 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 547 |
|
|---|
| 548 |
StaticDtorDeclaration *isStaticDtorDeclaration() { return this; } |
|---|
| 549 |
}; |
|---|
| 550 |
|
|---|
| 551 |
struct InvariantDeclaration : FuncDeclaration |
|---|
| 552 |
{ |
|---|
| 553 |
InvariantDeclaration(Loc loc, Loc endloc); |
|---|
| 554 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 555 |
void semantic(Scope *sc); |
|---|
| 556 |
int isVirtual(); |
|---|
| 557 |
int addPreInvariant(); |
|---|
| 558 |
int addPostInvariant(); |
|---|
| 559 |
void emitComment(Scope *sc); |
|---|
| 560 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 561 |
|
|---|
| 562 |
InvariantDeclaration *isInvariantDeclaration() { return this; } |
|---|
| 563 |
}; |
|---|
| 564 |
|
|---|
| 565 |
|
|---|
| 566 |
struct UnitTestDeclaration : FuncDeclaration |
|---|
| 567 |
{ |
|---|
| 568 |
UnitTestDeclaration(Loc loc, Loc endloc); |
|---|
| 569 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 570 |
void semantic(Scope *sc); |
|---|
| 571 |
AggregateDeclaration *isThis(); |
|---|
| 572 |
int isVirtual(); |
|---|
| 573 |
int addPreInvariant(); |
|---|
| 574 |
int addPostInvariant(); |
|---|
| 575 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 576 |
|
|---|
| 577 |
UnitTestDeclaration *isUnitTestDeclaration() { return this; } |
|---|
| 578 |
}; |
|---|
| 579 |
|
|---|
| 580 |
struct NewDeclaration : FuncDeclaration |
|---|
| 581 |
{ Arguments *arguments; |
|---|
| 582 |
int varargs; |
|---|
| 583 |
|
|---|
| 584 |
NewDeclaration(Loc loc, Loc endloc, Arguments *arguments, int varargs); |
|---|
| 585 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 586 |
void semantic(Scope *sc); |
|---|
| 587 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 588 |
char *kind(); |
|---|
| 589 |
int isVirtual(); |
|---|
| 590 |
int addPreInvariant(); |
|---|
| 591 |
int addPostInvariant(); |
|---|
| 592 |
|
|---|
| 593 |
NewDeclaration *isNewDeclaration() { return this; } |
|---|
| 594 |
}; |
|---|
| 595 |
|
|---|
| 596 |
|
|---|
| 597 |
struct DeleteDeclaration : FuncDeclaration |
|---|
| 598 |
{ Arguments *arguments; |
|---|
| 599 |
|
|---|
| 600 |
DeleteDeclaration(Loc loc, Loc endloc, Arguments *arguments); |
|---|
| 601 |
Dsymbol *syntaxCopy(Dsymbol *); |
|---|
| 602 |
void semantic(Scope *sc); |
|---|
| 603 |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
|---|
| 604 |
char *kind(); |
|---|
| 605 |
int isDelete(); |
|---|
| 606 |
int isVirtual(); |
|---|
| 607 |
int addPreInvariant(); |
|---|
| 608 |
int addPostInvariant(); |
|---|
| 609 |
#ifdef _DH |
|---|
| 610 |
DeleteDeclaration *isDeleteDeclaration() { return this; } |
|---|
| 611 |
#endif |
|---|
| 612 |
}; |
|---|
| 613 |
|
|---|
| 614 |
#endif /* DMD_DECLARATION_H */ |
|---|