Mercurial > projects > ldc
comparison dmd/template.h @ 1195:e961851fb8be
Merged DMD 1.042.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Fri, 03 Apr 2009 17:59:34 +0200 |
parents | 0b26cfb2d445 |
children | 8026319762be |
comparison
equal
deleted
inserted
replaced
1194:1853dcd9b944 | 1195:e961851fb8be |
---|---|
52 struct TemplateDeclaration : ScopeDsymbol | 52 struct TemplateDeclaration : ScopeDsymbol |
53 { | 53 { |
54 TemplateParameters *parameters; // array of TemplateParameter's | 54 TemplateParameters *parameters; // array of TemplateParameter's |
55 | 55 |
56 TemplateParameters *origParameters; // originals for Ddoc | 56 TemplateParameters *origParameters; // originals for Ddoc |
57 #if DMDV2 | |
58 Expression *constraint; | 57 Expression *constraint; |
59 #endif | |
60 Array instances; // array of TemplateInstance's | 58 Array instances; // array of TemplateInstance's |
61 | 59 |
62 TemplateDeclaration *overnext; // next overloaded TemplateDeclaration | 60 TemplateDeclaration *overnext; // next overloaded TemplateDeclaration |
63 TemplateDeclaration *overroot; // first in overnext list | 61 TemplateDeclaration *overroot; // first in overnext list |
64 | 62 |
65 Scope *scope; | 63 Scope *scope; |
66 Dsymbol *onemember; // if !=NULL then one member of this template | 64 Dsymbol *onemember; // if !=NULL then one member of this template |
67 | 65 |
68 TemplateDeclaration(Loc loc, Identifier *id, TemplateParameters *parameters, | 66 TemplateDeclaration(Loc loc, Identifier *id, TemplateParameters *parameters, |
69 #if DMDV2 | 67 Expression *constraint, Array *decldefs); |
70 Expression *constraint, | |
71 #endif | |
72 Array *decldefs); | |
73 Dsymbol *syntaxCopy(Dsymbol *); | 68 Dsymbol *syntaxCopy(Dsymbol *); |
74 void semantic(Scope *sc); | 69 void semantic(Scope *sc); |
75 int overloadInsert(Dsymbol *s); | 70 int overloadInsert(Dsymbol *s); |
76 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | 71 void toCBuffer(OutBuffer *buf, HdrGenState *hgs); |
77 const char *kind(); | 72 const char *kind(); |
79 | 74 |
80 void emitComment(Scope *sc); | 75 void emitComment(Scope *sc); |
81 // void toDocBuffer(OutBuffer *buf); | 76 // void toDocBuffer(OutBuffer *buf); |
82 | 77 |
83 MATCH matchWithInstance(TemplateInstance *ti, Objects *atypes, int flag); | 78 MATCH matchWithInstance(TemplateInstance *ti, Objects *atypes, int flag); |
84 int leastAsSpecialized(TemplateDeclaration *td2); | 79 MATCH leastAsSpecialized(TemplateDeclaration *td2); |
85 | 80 |
86 MATCH deduceFunctionTemplateMatch(Loc loc, Objects *targsi, Expression *ethis, Expressions *fargs, Objects *dedargs); | 81 MATCH deduceFunctionTemplateMatch(Loc loc, Objects *targsi, Expression *ethis, Expressions *fargs, Objects *dedargs); |
87 FuncDeclaration *deduceFunctionTemplate(Scope *sc, Loc loc, Objects *targsi, Expression *ethis, Expressions *fargs, int flags = 0); | 82 FuncDeclaration *deduceFunctionTemplate(Scope *sc, Loc loc, Objects *targsi, Expression *ethis, Expressions *fargs, int flags = 0); |
88 void declareParameter(Scope *sc, TemplateParameter *tp, Object *o); | 83 void declareParameter(Scope *sc, TemplateParameter *tp, Object *o); |
89 | 84 |
106 * For value-parameter: | 101 * For value-parameter: |
107 * template Foo(valType ident) // specValue is set to NULL | 102 * template Foo(valType ident) // specValue is set to NULL |
108 * template Foo(valType ident : specValue) | 103 * template Foo(valType ident : specValue) |
109 * For alias-parameter: | 104 * For alias-parameter: |
110 * template Foo(alias ident) | 105 * template Foo(alias ident) |
106 * For this-parameter: | |
107 * template Foo(this ident) | |
111 */ | 108 */ |
112 | 109 |
113 Loc loc; | 110 Loc loc; |
114 Identifier *ident; | 111 Identifier *ident; |
115 | 112 |
214 }; | 211 }; |
215 | 212 |
216 struct TemplateAliasParameter : TemplateParameter | 213 struct TemplateAliasParameter : TemplateParameter |
217 { | 214 { |
218 /* Syntax: | 215 /* Syntax: |
219 * ident : specAlias = defaultAlias | 216 * specType ident : specAlias = defaultAlias |
220 */ | 217 */ |
221 | 218 |
222 Type *specAliasT; | 219 Type *specAliasT; |
223 Dsymbol *specAlias; | 220 Dsymbol *specAlias; |
224 | 221 |
315 #if IN_DMD | 312 #if IN_DMD |
316 void toObjFile(int multiobj); // compile to .obj file | 313 void toObjFile(int multiobj); // compile to .obj file |
317 #endif | 314 #endif |
318 | 315 |
319 // Internal | 316 // Internal |
320 static void semanticTiargs(Loc loc, Scope *sc, Objects *tiargs); | 317 static void semanticTiargs(Loc loc, Scope *sc, Objects *tiargs, int flags); |
321 void semanticTiargs(Scope *sc); | 318 void semanticTiargs(Scope *sc); |
322 TemplateDeclaration *findTemplateDeclaration(Scope *sc); | 319 TemplateDeclaration *findTemplateDeclaration(Scope *sc); |
323 TemplateDeclaration *findBestMatch(Scope *sc); | 320 TemplateDeclaration *findBestMatch(Scope *sc); |
324 void declareParameters(Scope *sc); | 321 void declareParameters(Scope *sc); |
325 int hasNestedArgs(Objects *tiargs); | 322 int hasNestedArgs(Objects *tiargs); |