2 // Copyright (c) 1999-2005 by Digital Mars
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.
10 /* NOTE: This file has been patched from the original DMD distribution to
11 work with the GDC compiler.
13 Modified by David Friedman, December 2006
29 struct SwitchStatement
;
30 struct TryFinallyStatement
;
31 struct LabelStatement
;
32 struct ForeachStatement
;
33 struct ClassDeclaration
;
34 struct AggregateDeclaration
;
35 struct AnonymousAggregateDeclaration
;
36 struct FuncDeclaration
;
43 Scope
*enclosing
; // enclosing Scope
45 Module
*module
; // Root module
46 ScopeDsymbol
*scopesym
; // current symbol
47 ScopeDsymbol
*sd
; // if in static if, and declaring new symbols,
48 // sd gets the addMember()
49 FuncDeclaration
*func
; // function we are in
50 Dsymbol
*parent
; // parent to use
51 LabelStatement
*slabel
; // enclosing labelled statement
52 SwitchStatement
*sw
; // enclosing switch statement
53 TryFinallyStatement
*tf
; // enclosing try finally statement
54 Statement
*sbreak
; // enclosing statement that supports "break"
55 Statement
*scontinue
; // enclosing statement that supports "continue"
56 ForeachStatement
*fes
; // if nested function for ForeachStatement, this is it
57 target_size_t offset
; // next offset to use in aggregate
58 int inunion
; // we're processing members of a union
59 int incontract
; // we're inside contract code
60 int nofree
; // set if shouldn't free it
61 int noctor
; // set if constructor calls aren't allowed
62 int intypeof
; // in typeof(exp)
63 int parameterSpecialization
; // if in template parameter specialization
64 int noaccesscheck
; // don't do access checks
65 bool inDtemplate
; // use D type rules, not Dlt ones, in this template
67 unsigned callSuper
; // primitive flow analysis for constructors
68 #define CSXthis_ctor 1 // called this()
69 #define CSXsuper_ctor 2 // called super()
70 #define CSXthis 4 // referenced this
71 #define CSXsuper 8 // referenced super
72 #define CSXlabel 0x10 // seen a label
73 #define CSXreturn 0x20 // seen a return statement
74 #define CSXany_ctor 0x40 // either this() or super() was called
76 unsigned structalign
; // alignment for struct members
77 enum LINK linkage
; // linkage for external functions
79 enum PROT protection
; // protection for class members
80 int explicitProtection
; // set if in an explicit protection attribute
82 unsigned stc
; // storage class
83 Expressions
* attributes
; // GCC decl/type attributes
86 #define SCOPEctor 1 // constructor type
87 #define SCOPEstaticif 2 // inside static if
88 #define SCOPEfree 4 // is on free list
90 AnonymousAggregateDeclaration
*anonAgg
; // for temporary analysis
92 DocComment
*lastdc
; // documentation comment for last symbol at this scope
93 unsigned lastoffset
; // offset in docbuf of where to insert next dec
94 OutBuffer
*docbuf
; // buffer for documentation output
96 static Scope
*freelist
;
97 static void *operator new(size_t sz
);
98 static Scope
*createGlobal(Module
*module
);
101 Scope(Module
*module
);
102 Scope(Scope
*enclosing
);
105 Scope
*push(ScopeDsymbol
*ss
);
108 void mergeCallSuper(Loc loc
, unsigned cs
);
110 Dsymbol
*search(Loc loc
, Identifier
*ident
, Dsymbol
**pscopesym
);
111 Dsymbol
*insert(Dsymbol
*s
);
113 ClassDeclaration
*getClassScope();
114 AggregateDeclaration
*getStructClassScope();
118 #endif /* DMD_SCOPE_H */