Mercurial > projects > ldc
annotate dmd/scope.h @ 671:96e425004a68
When newing a struct, make sure the initializer is available.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Wed, 08 Oct 2008 20:41:43 +0200 |
parents | d4e95db0e62b |
children | 041c1596d217 |
rev | line source |
---|---|
159 | 1 |
2 // Copyright (c) 1999-2005 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_SCOPE_H | |
11 #define DMD_SCOPE_H | |
12 | |
13 #ifdef __DMC__ | |
14 #pragma once | |
15 #endif /* __DMC__ */ | |
16 | |
17 struct Dsymbol; | |
18 struct ScopeDsymbol; | |
19 struct Array; | |
20 struct Identifier; | |
21 struct Module; | |
22 struct Statement; | |
23 struct SwitchStatement; | |
24 struct TryFinallyStatement; | |
25 struct LabelStatement; | |
26 struct ForeachStatement; | |
27 struct ClassDeclaration; | |
28 struct AggregateDeclaration; | |
29 struct AnonymousAggregateDeclaration; | |
30 struct FuncDeclaration; | |
31 struct DocComment; | |
309 | 32 struct EnclosingHandler; |
159 | 33 enum LINK; |
34 enum PROT; | |
35 | |
36 struct Scope | |
37 { | |
38 Scope *enclosing; // enclosing Scope | |
39 | |
40 Module *module; // Root module | |
41 ScopeDsymbol *scopesym; // current symbol | |
42 ScopeDsymbol *sd; // if in static if, and declaring new symbols, | |
43 // sd gets the addMember() | |
44 FuncDeclaration *func; // function we are in | |
45 Dsymbol *parent; // parent to use | |
46 LabelStatement *slabel; // enclosing labelled statement | |
47 SwitchStatement *sw; // enclosing switch statement | |
48 TryFinallyStatement *tf; // enclosing try finally statement; set inside its finally block | |
309 | 49 EnclosingHandler *tfOfTry; // enclosing try-finally, volatile or synchronized statement; set inside its try or body block |
561
d4e95db0e62b
Introducing template instantiation traces for static asserts and errors within templates.
Christian Kamm <kamm incasoftware de>
parents:
309
diff
changeset
|
50 TemplateInstance *tinst; // enclosing template instance |
159 | 51 Statement *sbreak; // enclosing statement that supports "break" |
52 Statement *scontinue; // enclosing statement that supports "continue" | |
53 ForeachStatement *fes; // if nested function for ForeachStatement, this is it | |
54 unsigned offset; // next offset to use in aggregate | |
55 int inunion; // we're processing members of a union | |
56 int incontract; // we're inside contract code | |
57 int nofree; // set if shouldn't free it | |
58 int noctor; // set if constructor calls aren't allowed | |
59 int intypeof; // in typeof(exp) | |
60 int parameterSpecialization; // if in template parameter specialization | |
61 int noaccesscheck; // don't do access checks | |
62 | |
63 unsigned callSuper; // primitive flow analysis for constructors | |
64 #define CSXthis_ctor 1 // called this() | |
65 #define CSXsuper_ctor 2 // called super() | |
66 #define CSXthis 4 // referenced this | |
67 #define CSXsuper 8 // referenced super | |
68 #define CSXlabel 0x10 // seen a label | |
69 #define CSXreturn 0x20 // seen a return statement | |
70 #define CSXany_ctor 0x40 // either this() or super() was called | |
71 | |
72 unsigned structalign; // alignment for struct members | |
73 enum LINK linkage; // linkage for external functions | |
74 | |
75 enum PROT protection; // protection for class members | |
76 int explicitProtection; // set if in an explicit protection attribute | |
77 | |
78 unsigned stc; // storage class | |
79 | |
80 unsigned flags; | |
81 #define SCOPEctor 1 // constructor type | |
82 #define SCOPEstaticif 2 // inside static if | |
83 #define SCOPEfree 4 // is on free list | |
84 | |
85 AnonymousAggregateDeclaration *anonAgg; // for temporary analysis | |
86 | |
87 DocComment *lastdc; // documentation comment for last symbol at this scope | |
88 unsigned lastoffset; // offset in docbuf of where to insert next dec | |
89 OutBuffer *docbuf; // buffer for documentation output | |
90 | |
91 static Scope *freelist; | |
92 static void *operator new(size_t sz); | |
93 static Scope *createGlobal(Module *module); | |
94 | |
95 Scope(); | |
96 Scope(Module *module); | |
97 Scope(Scope *enclosing); | |
98 | |
99 Scope *push(); | |
100 Scope *push(ScopeDsymbol *ss); | |
101 Scope *pop(); | |
102 | |
103 void mergeCallSuper(Loc loc, unsigned cs); | |
104 | |
105 Dsymbol *search(Loc loc, Identifier *ident, Dsymbol **pscopesym); | |
106 Dsymbol *insert(Dsymbol *s); | |
107 | |
108 ClassDeclaration *getClassScope(); | |
109 AggregateDeclaration *getStructClassScope(); | |
110 void setNoFree(); | |
111 }; | |
112 | |
113 #endif /* DMD_SCOPE_H */ |