Mercurial > projects > ldc
annotate dmd/scope.h @ 149:4c577c2b7229 trunk
[svn r155] Fixed a bunch of linkage problems (especially with templates)
author | lindquist |
---|---|
date | Mon, 24 Mar 2008 19:43:02 +0100 |
parents | 8f704cb9969b |
children | 5acec6b2eef8 |
rev | line source |
---|---|
1 | 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; | |
32 enum LINK; | |
33 enum PROT; | |
34 | |
35 struct Scope | |
36 { | |
37 Scope *enclosing; // enclosing Scope | |
38 | |
39 Module *module; // Root module | |
40 ScopeDsymbol *scopesym; // current symbol | |
41 ScopeDsymbol *sd; // if in static if, and declaring new symbols, | |
42 // sd gets the addMember() | |
43 FuncDeclaration *func; // function we are in | |
44 Dsymbol *parent; // parent to use | |
45 LabelStatement *slabel; // enclosing labelled statement | |
46 SwitchStatement *sw; // enclosing switch statement | |
145
8f704cb9969b
[svn r150] fixes #16 and #17, implements GotoCaseStatement
ChristianK
parents:
1
diff
changeset
|
47 TryFinallyStatement *tf; // enclosing try finally statement; set inside its finally block |
8f704cb9969b
[svn r150] fixes #16 and #17, implements GotoCaseStatement
ChristianK
parents:
1
diff
changeset
|
48 TryFinallyStatement *tfOfTry; // enclosing try finally statement; set inside its try block |
1 | 49 Statement *sbreak; // enclosing statement that supports "break" |
50 Statement *scontinue; // enclosing statement that supports "continue" | |
51 ForeachStatement *fes; // if nested function for ForeachStatement, this is it | |
52 unsigned offset; // next offset to use in aggregate | |
53 int inunion; // we're processing members of a union | |
54 int incontract; // we're inside contract code | |
55 int nofree; // set if shouldn't free it | |
56 int noctor; // set if constructor calls aren't allowed | |
57 int intypeof; // in typeof(exp) | |
58 int parameterSpecialization; // if in template parameter specialization | |
59 | |
60 unsigned callSuper; // primitive flow analysis for constructors | |
61 #define CSXthis_ctor 1 // called this() | |
62 #define CSXsuper_ctor 2 // called super() | |
63 #define CSXthis 4 // referenced this | |
64 #define CSXsuper 8 // referenced super | |
65 #define CSXlabel 0x10 // seen a label | |
66 #define CSXreturn 0x20 // seen a return statement | |
67 #define CSXany_ctor 0x40 // either this() or super() was called | |
68 | |
69 unsigned structalign; // alignment for struct members | |
70 enum LINK linkage; // linkage for external functions | |
71 | |
72 enum PROT protection; // protection for class members | |
73 int explicitProtection; // set if in an explicit protection attribute | |
74 | |
75 unsigned stc; // storage class | |
76 | |
77 unsigned flags; | |
78 #define SCOPEctor 1 // constructor type | |
79 #define SCOPEstaticif 2 // inside static if | |
80 #define SCOPEfree 4 // is on free list | |
81 | |
82 AnonymousAggregateDeclaration *anonAgg; // for temporary analysis | |
83 | |
84 DocComment *lastdc; // documentation comment for last symbol at this scope | |
85 unsigned lastoffset; // offset in docbuf of where to insert next dec | |
86 OutBuffer *docbuf; // buffer for documentation output | |
87 | |
88 static Scope *freelist; | |
89 static void *operator new(size_t sz); | |
90 static Scope *createGlobal(Module *module); | |
91 | |
92 Scope(); | |
93 Scope(Module *module); | |
94 Scope(Scope *enclosing); | |
95 | |
96 Scope *push(); | |
97 Scope *push(ScopeDsymbol *ss); | |
98 Scope *pop(); | |
99 | |
100 void mergeCallSuper(Loc loc, unsigned cs); | |
101 | |
102 Dsymbol *search(Loc loc, Identifier *ident, Dsymbol **pscopesym); | |
103 Dsymbol *insert(Dsymbol *s); | |
104 | |
105 ClassDeclaration *getClassScope(); | |
106 AggregateDeclaration *getStructClassScope(); | |
107 void setNoFree(); | |
108 }; | |
109 | |
110 #endif /* DMD_SCOPE_H */ |