Mercurial > projects > ldc
annotate dmd/scope.h @ 1638:0de4525a9ed6
Apply workaround for #395 by klickverbot.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Mon, 08 Mar 2010 20:06:08 +0100 |
parents | a413ae7329bf |
children | 9bf06e02070b |
rev | line source |
---|---|
1587 | 1 |
2 // Copyright (c) 1999-2009 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 | |
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; | |
32 struct TemplateInstance; | |
33 | |
34 #if IN_LLVM | |
35 struct EnclosingHandler; | |
36 struct AnonDeclaration; | |
37 #endif | |
38 | |
39 #if __GNUC__ | |
40 // Requires a full definition for PROT and LINK | |
41 #include "dsymbol.h" // PROT | |
42 #include "mars.h" // LINK | |
43 #else | |
44 enum LINK; | |
45 enum PROT; | |
46 #endif | |
47 | |
48 struct Scope | |
49 { | |
50 Scope *enclosing; // enclosing Scope | |
51 | |
52 Module *module; // Root module | |
53 ScopeDsymbol *scopesym; // current symbol | |
54 ScopeDsymbol *sd; // if in static if, and declaring new symbols, | |
55 // sd gets the addMember() | |
56 FuncDeclaration *func; // function we are in | |
57 Dsymbol *parent; // parent to use | |
58 LabelStatement *slabel; // enclosing labelled statement | |
59 SwitchStatement *sw; // enclosing switch statement | |
60 TryFinallyStatement *enclosingFinally; // enclosing try finally statement; set inside its finally block | |
61 TemplateInstance *tinst; // enclosing template instance | |
62 Statement *enclosingScopeExit; // enclosing statement that wants to do something on scope exit | |
63 Statement *sbreak; // enclosing statement that supports "break" | |
64 Statement *scontinue; // enclosing statement that supports "continue" | |
65 ForeachStatement *fes; // if nested function for ForeachStatement, this is it | |
66 unsigned offset; // next offset to use in aggregate | |
67 int inunion; // we're processing members of a union | |
68 int incontract; // we're inside contract code | |
69 int nofree; // set if shouldn't free it | |
70 int noctor; // set if constructor calls aren't allowed | |
71 int intypeof; // in typeof(exp) | |
72 int parameterSpecialization; // if in template parameter specialization | |
73 int noaccesscheck; // don't do access checks | |
74 int mustsemantic; // cannot defer semantic() | |
75 | |
76 unsigned callSuper; // primitive flow analysis for constructors | |
77 #define CSXthis_ctor 1 // called this() | |
78 #define CSXsuper_ctor 2 // called super() | |
79 #define CSXthis 4 // referenced this | |
80 #define CSXsuper 8 // referenced super | |
81 #define CSXlabel 0x10 // seen a label | |
82 #define CSXreturn 0x20 // seen a return statement | |
83 #define CSXany_ctor 0x40 // either this() or super() was called | |
84 | |
85 unsigned structalign; // alignment for struct members | |
86 enum LINK linkage; // linkage for external functions | |
87 | |
88 enum PROT protection; // protection for class members | |
89 int explicitProtection; // set if in an explicit protection attribute | |
90 | |
1602
a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
Leandro Lucarella <llucax@gmail.com>
parents:
1587
diff
changeset
|
91 StorageClass stc; // storage class |
1587 | 92 |
93 unsigned flags; | |
94 #define SCOPEctor 1 // constructor type | |
95 #define SCOPEstaticif 2 // inside static if | |
96 #define SCOPEfree 4 // is on free list | |
97 | |
98 AnonymousAggregateDeclaration *anonAgg; // for temporary analysis | |
99 | |
100 DocComment *lastdc; // documentation comment for last symbol at this scope | |
101 unsigned lastoffset; // offset in docbuf of where to insert next dec | |
102 OutBuffer *docbuf; // buffer for documentation output | |
103 | |
104 static Scope *freelist; | |
105 static void *operator new(size_t sz); | |
106 static Scope *createGlobal(Module *module); | |
107 | |
108 Scope(); | |
109 Scope(Module *module); | |
110 Scope(Scope *enclosing); | |
111 | |
112 Scope *push(); | |
113 Scope *push(ScopeDsymbol *ss); | |
114 Scope *pop(); | |
115 | |
116 void mergeCallSuper(Loc loc, unsigned cs); | |
117 | |
118 Dsymbol *search(Loc loc, Identifier *ident, Dsymbol **pscopesym); | |
119 Dsymbol *insert(Dsymbol *s); | |
120 | |
121 ClassDeclaration *getClassScope(); | |
122 AggregateDeclaration *getStructClassScope(); | |
123 void setNoFree(); | |
124 }; | |
125 | |
126 #endif /* DMD_SCOPE_H */ |