Mercurial > projects > ddmd
comparison dmd/TemplateTypeParameter.d @ 72:2e2a5c3f943a
reduced warnings by adding override to the methods
think this also normalizes different line endings used all over the place
author | Trass3r |
---|---|
date | Sat, 28 Aug 2010 16:19:48 +0200 |
parents | b7d29f613539 |
children | 3a0b150c9841 |
comparison
equal
deleted
inserted
replaced
71:8e24ef1dd139 | 72:2e2a5c3f943a |
---|---|
29 this.ident = ident; | 29 this.ident = ident; |
30 this.specType = specType; | 30 this.specType = specType; |
31 this.defaultType = defaultType; | 31 this.defaultType = defaultType; |
32 } | 32 } |
33 | 33 |
34 TemplateTypeParameter isTemplateTypeParameter() | 34 override TemplateTypeParameter isTemplateTypeParameter() |
35 { | 35 { |
36 return this; | 36 return this; |
37 } | 37 } |
38 | 38 |
39 TemplateParameter syntaxCopy() | 39 override TemplateParameter syntaxCopy() |
40 { | 40 { |
41 TemplateTypeParameter tp = new TemplateTypeParameter(loc, ident, specType, defaultType); | 41 TemplateTypeParameter tp = new TemplateTypeParameter(loc, ident, specType, defaultType); |
42 if (tp.specType) | 42 if (tp.specType) |
43 tp.specType = specType.syntaxCopy(); | 43 tp.specType = specType.syntaxCopy(); |
44 if (defaultType) | 44 if (defaultType) |
45 tp.defaultType = defaultType.syntaxCopy(); | 45 tp.defaultType = defaultType.syntaxCopy(); |
46 return tp; | 46 return tp; |
47 } | 47 } |
48 | 48 |
49 void declareParameter(Scope sc) | 49 override void declareParameter(Scope sc) |
50 { | 50 { |
51 //printf("TemplateTypeParameter.declareParameter('%s')\n", ident.toChars()); | 51 //printf("TemplateTypeParameter.declareParameter('%s')\n", ident.toChars()); |
52 TypeIdentifier ti = new TypeIdentifier(loc, ident); | 52 TypeIdentifier ti = new TypeIdentifier(loc, ident); |
53 sparam = new AliasDeclaration(loc, ident, ti); | 53 sparam = new AliasDeclaration(loc, ident, ti); |
54 if (!sc.insert(sparam)) | 54 if (!sc.insert(sparam)) |
55 error(loc, "parameter '%s' multiply defined", ident.toChars()); | 55 error(loc, "parameter '%s' multiply defined", ident.toChars()); |
56 } | 56 } |
57 | 57 |
58 void semantic(Scope sc) | 58 override void semantic(Scope sc) |
59 { | 59 { |
60 //printf("TemplateTypeParameter.semantic('%s')\n", ident.toChars()); | 60 //printf("TemplateTypeParameter.semantic('%s')\n", ident.toChars()); |
61 if (specType) | 61 if (specType) |
62 { | 62 { |
63 specType = specType.semantic(loc, sc); | 63 specType = specType.semantic(loc, sc); |
68 defaultType = defaultType.semantic(loc, sc); | 68 defaultType = defaultType.semantic(loc, sc); |
69 } | 69 } |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 void print(Object oarg, Object oded) | 73 override void print(Object oarg, Object oded) |
74 { | 74 { |
75 assert(false); | 75 assert(false); |
76 } | 76 } |
77 | 77 |
78 void toCBuffer(OutBuffer buf, HdrGenState* hgs) | 78 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
79 { | 79 { |
80 buf.writestring(ident.toChars()); | 80 buf.writestring(ident.toChars()); |
81 if (specType) | 81 if (specType) |
82 { | 82 { |
83 buf.writestring(" : "); | 83 buf.writestring(" : "); |
88 buf.writestring(" = "); | 88 buf.writestring(" = "); |
89 defaultType.toCBuffer(buf, null, hgs); | 89 defaultType.toCBuffer(buf, null, hgs); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 Object specialization() | 93 override Object specialization() |
94 { | 94 { |
95 return specType; | 95 return specType; |
96 } | 96 } |
97 | 97 |
98 Object defaultArg(Loc loc, Scope sc) | 98 override Object defaultArg(Loc loc, Scope sc) |
99 { | 99 { |
100 Type t; | 100 Type t; |
101 | 101 |
102 t = defaultType; | 102 t = defaultType; |
103 if (t) | 103 if (t) |
106 t = t.semantic(loc, sc); | 106 t = t.semantic(loc, sc); |
107 } | 107 } |
108 return t; | 108 return t; |
109 } | 109 } |
110 | 110 |
111 bool overloadMatch(TemplateParameter) | 111 override bool overloadMatch(TemplateParameter) |
112 { | 112 { |
113 assert(false); | 113 assert(false); |
114 } | 114 } |
115 | 115 |
116 /******************************************* | 116 /******************************************* |
121 * parameters[] template parameters | 121 * parameters[] template parameters |
122 * dedtypes[] deduced arguments to template instance | 122 * dedtypes[] deduced arguments to template instance |
123 * *psparam set to symbol declared and initialized to dedtypes[i] | 123 * *psparam set to symbol declared and initialized to dedtypes[i] |
124 * flags 1: don't do 'toHeadMutable()' | 124 * flags 1: don't do 'toHeadMutable()' |
125 */ | 125 */ |
126 MATCH matchArg(Scope sc, Objects tiargs, int i, TemplateParameters parameters, Objects dedtypes, Declaration* psparam, int flags) | 126 override MATCH matchArg(Scope sc, Objects tiargs, int i, TemplateParameters parameters, Objects dedtypes, Declaration* psparam, int flags) |
127 { | 127 { |
128 //printf("TemplateTypeParameter.matchArg()\n"); | 128 //printf("TemplateTypeParameter.matchArg()\n"); |
129 Type t; | 129 Type t; |
130 Object oarg; | 130 Object oarg; |
131 MATCH m = MATCHexact; | 131 MATCH m = MATCHexact; |
211 *psparam = null; | 211 *psparam = null; |
212 //printf("\tm = %d\n", MATCHnomatch); | 212 //printf("\tm = %d\n", MATCHnomatch); |
213 return MATCHnomatch; | 213 return MATCHnomatch; |
214 } | 214 } |
215 | 215 |
216 void* dummyArg() | 216 override void* dummyArg() |
217 { | 217 { |
218 Type t; | 218 Type t; |
219 | 219 |
220 if (specType) | 220 if (specType) |
221 t = specType; | 221 t = specType; |