annotate dmd/template.h @ 1367:8026319762be

Merged DMD 1.045 !!!
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Sat, 16 May 2009 22:21:31 +0200
parents e961851fb8be
children def7a1d494fd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
1
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
2 // Compiler implementation of the D programming language
1103
b30fe7e1dbb9 - Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1067
diff changeset
3 // Copyright (c) 1999-2009 by Digital Mars
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
4 // All Rights Reserved
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
5 // written by Walter Bright
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
6 // http://www.digitalmars.com
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
7 // License for redistribution is by either the Artistic License
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
8 // in artistic.txt, or the GNU General Public License in gnu.txt.
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
9 // See the included readme.txt for details.
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
10
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
11 #ifndef DMD_TEMPLATE_H
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
12 #define DMD_TEMPLATE_H
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
13
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
14 #ifdef __DMC__
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
15 #pragma once
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
16 #endif /* __DMC__ */
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
17
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 336
diff changeset
18 #include <string>
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 336
diff changeset
19
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
20 #include "root.h"
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
21 #include "arraytypes.h"
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
22 #include "dsymbol.h"
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
23 #include "mtype.h"
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
24
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
25
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
26 struct OutBuffer;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
27 struct Identifier;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
28 struct TemplateInstance;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
29 struct TemplateParameter;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
30 struct TemplateTypeParameter;
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
31 struct TemplateThisParameter;
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
32 struct TemplateValueParameter;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
33 struct TemplateAliasParameter;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
34 struct TemplateTupleParameter;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
35 struct Type;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
36 struct TypeTypeof;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
37 struct Scope;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
38 struct Expression;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
39 struct AliasDeclaration;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
40 struct FuncDeclaration;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
41 struct HdrGenState;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
42 enum MATCH;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
43
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
44 struct Tuple : Object
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
45 {
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
46 Objects objects;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
47
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
48 int dyncast() { return DYNCAST_TUPLE; } // kludge for template.isType()
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
49 };
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
50
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
51
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
52 struct TemplateDeclaration : ScopeDsymbol
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
53 {
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
54 TemplateParameters *parameters; // array of TemplateParameter's
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
55
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
56 TemplateParameters *origParameters; // originals for Ddoc
875
330f999ade44 Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
57 Expression *constraint;
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
58 Array instances; // array of TemplateInstance's
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
59
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
60 TemplateDeclaration *overnext; // next overloaded TemplateDeclaration
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
61 TemplateDeclaration *overroot; // first in overnext list
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
62
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
63 Scope *scope;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
64 Dsymbol *onemember; // if !=NULL then one member of this template
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
65
875
330f999ade44 Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
66 TemplateDeclaration(Loc loc, Identifier *id, TemplateParameters *parameters,
1195
e961851fb8be Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1174
diff changeset
67 Expression *constraint, Array *decldefs);
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
68 Dsymbol *syntaxCopy(Dsymbol *);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
69 void semantic(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
70 int overloadInsert(Dsymbol *s);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
71 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
72 const char *kind();
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
73 char *toChars();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
74
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
75 void emitComment(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
76 // void toDocBuffer(OutBuffer *buf);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
77
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
78 MATCH matchWithInstance(TemplateInstance *ti, Objects *atypes, int flag);
1195
e961851fb8be Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1174
diff changeset
79 MATCH leastAsSpecialized(TemplateDeclaration *td2);
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
80
875
330f999ade44 Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
81 MATCH deduceFunctionTemplateMatch(Loc loc, Objects *targsi, Expression *ethis, Expressions *fargs, Objects *dedargs);
330f999ade44 Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
82 FuncDeclaration *deduceFunctionTemplate(Scope *sc, Loc loc, Objects *targsi, Expression *ethis, Expressions *fargs, int flags = 0);
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
83 void declareParameter(Scope *sc, TemplateParameter *tp, Object *o);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
84
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
85 TemplateDeclaration *isTemplateDeclaration() { return this; }
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
86
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
87 TemplateTupleParameter *isVariadic();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
88 int isOverloadable();
1147
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
89
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
90 #if IN_LLVM
664
eef8ac26c66c Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents: 561
diff changeset
91 // LDC
527
cecfee2d01a8 Added support for overloaded intrinsics.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 336
diff changeset
92 std::string intrinsicName;
1147
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
93 #endif
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
94 };
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
95
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
96 struct TemplateParameter
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
97 {
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
98 /* For type-parameter:
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
99 * template Foo(ident) // specType is set to NULL
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
100 * template Foo(ident : specType)
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
101 * For value-parameter:
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
102 * template Foo(valType ident) // specValue is set to NULL
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
103 * template Foo(valType ident : specValue)
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
104 * For alias-parameter:
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
105 * template Foo(alias ident)
1195
e961851fb8be Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1174
diff changeset
106 * For this-parameter:
e961851fb8be Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1174
diff changeset
107 * template Foo(this ident)
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
108 */
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
109
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
110 Loc loc;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
111 Identifier *ident;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
112
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
113 Declaration *sparam;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
114
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
115 TemplateParameter(Loc loc, Identifier *ident);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
116
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
117 virtual TemplateTypeParameter *isTemplateTypeParameter();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
118 virtual TemplateValueParameter *isTemplateValueParameter();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
119 virtual TemplateAliasParameter *isTemplateAliasParameter();
875
330f999ade44 Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
120 #if DMDV2
330f999ade44 Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
121 virtual TemplateThisParameter *isTemplateThisParameter();
330f999ade44 Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
122 #endif
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
123 virtual TemplateTupleParameter *isTemplateTupleParameter();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
124
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
125 virtual TemplateParameter *syntaxCopy() = 0;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
126 virtual void declareParameter(Scope *sc) = 0;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
127 virtual void semantic(Scope *) = 0;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
128 virtual void print(Object *oarg, Object *oded) = 0;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
129 virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs) = 0;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
130 virtual Object *specialization() = 0;
875
330f999ade44 Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
131 virtual Object *defaultArg(Loc loc, Scope *sc) = 0;
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
132
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
133 /* If TemplateParameter's match as far as overloading goes.
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
134 */
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
135 virtual int overloadMatch(TemplateParameter *) = 0;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
136
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
137 /* Match actual argument against parameter.
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
138 */
1103
b30fe7e1dbb9 - Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1067
diff changeset
139 virtual MATCH matchArg(Scope *sc, Objects *tiargs, int i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam, int flags = 0) = 0;
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
140
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
141 /* Create dummy argument based on parameter.
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
142 */
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
143 virtual void *dummyArg() = 0;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
144 };
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
145
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
146 struct TemplateTypeParameter : TemplateParameter
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
147 {
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
148 /* Syntax:
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
149 * ident : specType = defaultType
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
150 */
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
151 Type *specType; // type parameter: if !=NULL, this is the type specialization
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
152 Type *defaultType;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
153
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
154 TemplateTypeParameter(Loc loc, Identifier *ident, Type *specType, Type *defaultType);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
155
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
156 TemplateTypeParameter *isTemplateTypeParameter();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
157 TemplateParameter *syntaxCopy();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
158 void declareParameter(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
159 void semantic(Scope *);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
160 void print(Object *oarg, Object *oded);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
161 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
162 Object *specialization();
875
330f999ade44 Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
163 Object *defaultArg(Loc loc, Scope *sc);
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
164 int overloadMatch(TemplateParameter *);
1103
b30fe7e1dbb9 - Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1067
diff changeset
165 MATCH matchArg(Scope *sc, Objects *tiargs, int i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam, int flags);
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
166 void *dummyArg();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
167 };
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
168
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
169 #if DMDV2
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
170 struct TemplateThisParameter : TemplateTypeParameter
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
171 {
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
172 /* Syntax:
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
173 * this ident : specType = defaultType
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
174 */
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
175 Type *specType; // type parameter: if !=NULL, this is the type specialization
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
176 Type *defaultType;
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
177
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
178 TemplateThisParameter(Loc loc, Identifier *ident, Type *specType, Type *defaultType);
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
179
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
180 TemplateThisParameter *isTemplateThisParameter();
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
181 TemplateParameter *syntaxCopy();
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
182 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
183 };
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
184 #endif
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
185
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
186 struct TemplateValueParameter : TemplateParameter
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
187 {
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
188 /* Syntax:
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
189 * valType ident : specValue = defaultValue
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
190 */
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
191
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
192 Type *valType;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
193 Expression *specValue;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
194 Expression *defaultValue;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
195
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
196 static Expression *edummy;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
197
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
198 TemplateValueParameter(Loc loc, Identifier *ident, Type *valType, Expression *specValue, Expression *defaultValue);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
199
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
200 TemplateValueParameter *isTemplateValueParameter();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
201 TemplateParameter *syntaxCopy();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
202 void declareParameter(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
203 void semantic(Scope *);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
204 void print(Object *oarg, Object *oded);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
205 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
206 Object *specialization();
875
330f999ade44 Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
207 Object *defaultArg(Loc loc, Scope *sc);
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
208 int overloadMatch(TemplateParameter *);
1103
b30fe7e1dbb9 - Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1067
diff changeset
209 MATCH matchArg(Scope *sc, Objects *tiargs, int i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam, int flags);
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
210 void *dummyArg();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
211 };
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
212
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
213 struct TemplateAliasParameter : TemplateParameter
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
214 {
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
215 /* Syntax:
1195
e961851fb8be Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1174
diff changeset
216 * specType ident : specAlias = defaultAlias
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
217 */
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
218
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
219 Type *specAliasT;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
220 Dsymbol *specAlias;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
221
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
222 Type *defaultAlias;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
223
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
224 static Dsymbol *sdummy;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
225
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
226 TemplateAliasParameter(Loc loc, Identifier *ident, Type *specAliasT, Type *defaultAlias);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
227
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
228 TemplateAliasParameter *isTemplateAliasParameter();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
229 TemplateParameter *syntaxCopy();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
230 void declareParameter(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
231 void semantic(Scope *);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
232 void print(Object *oarg, Object *oded);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
233 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
234 Object *specialization();
875
330f999ade44 Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
235 Object *defaultArg(Loc loc, Scope *sc);
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
236 int overloadMatch(TemplateParameter *);
1103
b30fe7e1dbb9 - Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1067
diff changeset
237 MATCH matchArg(Scope *sc, Objects *tiargs, int i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam, int flags);
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
238 void *dummyArg();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
239 };
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
240
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
241 struct TemplateTupleParameter : TemplateParameter
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
242 {
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
243 /* Syntax:
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
244 * ident ...
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
245 */
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
246
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
247 TemplateTupleParameter(Loc loc, Identifier *ident);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
248
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
249 TemplateTupleParameter *isTemplateTupleParameter();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
250 TemplateParameter *syntaxCopy();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
251 void declareParameter(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
252 void semantic(Scope *);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
253 void print(Object *oarg, Object *oded);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
254 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
255 Object *specialization();
875
330f999ade44 Merged DMD 1.038
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 664
diff changeset
256 Object *defaultArg(Loc loc, Scope *sc);
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
257 int overloadMatch(TemplateParameter *);
1103
b30fe7e1dbb9 - Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1067
diff changeset
258 MATCH matchArg(Scope *sc, Objects *tiargs, int i, TemplateParameters *parameters, Objects *dedtypes, Declaration **psparam, int flags);
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
259 void *dummyArg();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
260 };
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
261
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
262 struct TemplateInstance : ScopeDsymbol
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
263 {
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
264 /* Given:
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
265 * foo!(args) =>
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
266 * name = foo
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
267 * tiargs = args
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
268 */
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
269 Identifier *name;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
270 //Array idents;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
271 Objects *tiargs; // Array of Types/Expressions of template
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
272 // instance arguments [int*, char, 10*10]
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
273
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
274 Objects tdtypes; // Array of Types/Expressions corresponding
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
275 // to TemplateDeclaration.parameters
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
276 // [int, char, 100]
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
277
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
278 TemplateDeclaration *tempdecl; // referenced by foo.bar.abc
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
279 TemplateInstance *inst; // refer to existing instance
1367
8026319762be Merged DMD 1.045 !!!
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1195
diff changeset
280 TemplateInstance *tinst; // enclosing template instance
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
281 ScopeDsymbol *argsym; // argument symbol table
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
282 AliasDeclaration *aliasdecl; // !=NULL if instance is an alias for its
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
283 // sole member
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
284 WithScopeSymbol *withsym; // if a member of a with statement
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
285 int semanticdone; // has semantic() been done?
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
286 int semantictiargsdone; // has semanticTiargs() been done?
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
287 int nest; // for recursion detection
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
288 int havetempdecl; // 1 if used second constructor
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
289 Dsymbol *isnested; // if referencing local symbols, this is the context
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
290 int errors; // 1 if compiled with errors
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
291 #ifdef IN_GCC
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
292 /* On some targets, it is necessary to know whether a symbol
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
293 will be emitted in the output or not before the symbol
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
294 is used. This can be different from getModule(). */
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
295 Module * objFileModule;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
296 #endif
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
297
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
298 TemplateInstance(Loc loc, Identifier *temp_id);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
299 TemplateInstance(Loc loc, TemplateDeclaration *tempdecl, Objects *tiargs);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
300 static Objects *arraySyntaxCopy(Objects *objs);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
301 Dsymbol *syntaxCopy(Dsymbol *);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
302 void semantic(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
303 void semantic2(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
304 void semantic3(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
305 void inlineScan();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
306 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
307 Dsymbol *toAlias(); // resolve real symbol
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
308 const char *kind();
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
309 int oneMember(Dsymbol **ps);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
310 char *toChars();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
311 char *mangle();
1367
8026319762be Merged DMD 1.045 !!!
Tomas Lindquist Olsen <tomas.l.olsen gmail com>
parents: 1195
diff changeset
312 void printInstantiationTrace();
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
313
1147
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
314 #if IN_DMD
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
315 void toObjFile(int multiobj); // compile to .obj file
1147
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
316 #endif
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
317
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
318 // Internal
1195
e961851fb8be Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1174
diff changeset
319 static void semanticTiargs(Loc loc, Scope *sc, Objects *tiargs, int flags);
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
320 void semanticTiargs(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
321 TemplateDeclaration *findTemplateDeclaration(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
322 TemplateDeclaration *findBestMatch(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
323 void declareParameters(Scope *sc);
1103
b30fe7e1dbb9 - Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1067
diff changeset
324 int hasNestedArgs(Objects *tiargs);
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
325 Identifier *genIdent();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
326
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
327 TemplateInstance *isTemplateInstance() { return this; }
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
328 AliasDeclaration *isAliasDeclaration();
561
d4e95db0e62b Introducing template instantiation traces for static asserts and errors within templates.
Christian Kamm <kamm incasoftware de>
parents: 527
diff changeset
329
1147
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
330 #if IN_LLVM
664
eef8ac26c66c Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents: 561
diff changeset
331 // LDC
940
39519a1ff603 Changed the way LDC determines if a template instantiation needs to get a definition, seems to speed up compile times quite a bit in some cases.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 875
diff changeset
332 Module* tmodule; // module from outermost enclosing template instantiation
1067
7ce8355fbcc6 Improved template emission control for singleobj building.
Christian Kamm <kamm incasoftware de>
parents: 940
diff changeset
333 Module* emittedInModule; // which module this template instance has been emitted in
1147
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
334
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
335 void codegen(Ir*);
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
336 #endif
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
337 };
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
338
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
339 struct TemplateMixin : TemplateInstance
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
340 {
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
341 Array *idents;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
342 Type *tqual;
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
343
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
344 Scope *scope; // for forward referencing
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
345
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
346 TemplateMixin(Loc loc, Identifier *ident, Type *tqual, Array *idents, Objects *tiargs);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
347 Dsymbol *syntaxCopy(Dsymbol *s);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
348 void semantic(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
349 void semantic2(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
350 void semantic3(Scope *sc);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
351 void inlineScan();
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
352 const char *kind();
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
353 int oneMember(Dsymbol **ps);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
354 int hasPointers();
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
355 char *toChars();
321
571959608194 [svn r342] Fix DMD bug 2206.
ChristianK
parents: 159
diff changeset
356 char *mangle();
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
357 void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
358
1147
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
359 #if IN_DMD
336
aaade6ded589 [svn r357] Merged DMD 1.033
lindquist
parents: 321
diff changeset
360 void toObjFile(int multiobj); // compile to .obj file
1147
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
361 #endif
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
362
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
363 TemplateMixin *isTemplateMixin() { return this; }
1147
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
364
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
365 #if IN_LLVM
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
366 void codegen(Ir*);
dbe4af57b240 Changed use of toObjFile to a new codegen method.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents: 1103
diff changeset
367 #endif
159
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
368 };
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
369
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
370 Expression *isExpression(Object *o);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
371 Dsymbol *isDsymbol(Object *o);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
372 Type *isType(Object *o);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
373 Tuple *isTuple(Object *o);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
374 Type *getType(Object *o);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
375 Dsymbol *getDsymbol(Object *o);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
376
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
377 void ObjectToCBuffer(OutBuffer *buf, HdrGenState *hgs, Object *oarg);
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
378
5acec6b2eef8 [svn r175] merged dmd 1.029
ChristianK
parents: 130
diff changeset
379 #endif /* DMD_TEMPLATE_H */
1174
0b26cfb2d445 Add newlines to end of file.
Christian Kamm <kamm incasoftware de>
parents: 1147
diff changeset
380