Mercurial > projects > ddmd
comparison dmd/ThisExp.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 | cab4c37afb89 |
children | e28b18c23469 |
comparison
equal
deleted
inserted
replaced
71:8e24ef1dd139 | 72:2e2a5c3f943a |
---|---|
34 { | 34 { |
35 super(loc, TOK.TOKthis, ThisExp.sizeof); | 35 super(loc, TOK.TOKthis, ThisExp.sizeof); |
36 //printf("ThisExp::ThisExp() loc = %d\n", loc.linnum); | 36 //printf("ThisExp::ThisExp() loc = %d\n", loc.linnum); |
37 } | 37 } |
38 | 38 |
39 Expression semantic(Scope sc) | 39 override Expression semantic(Scope sc) |
40 { | 40 { |
41 FuncDeclaration fd; | 41 FuncDeclaration fd; |
42 FuncDeclaration fdthis; | 42 FuncDeclaration fdthis; |
43 | 43 |
44 version (LOGSEMANTIC) { | 44 version (LOGSEMANTIC) { |
100 error("'this' is only defined in non-static member functions, not %s", sc.parent.toChars()); | 100 error("'this' is only defined in non-static member functions, not %s", sc.parent.toChars()); |
101 type = Type.terror; | 101 type = Type.terror; |
102 return this; | 102 return this; |
103 } | 103 } |
104 | 104 |
105 Expression interpret(InterState istate) | 105 override Expression interpret(InterState istate) |
106 { | 106 { |
107 assert(false); | 107 assert(false); |
108 } | 108 } |
109 | 109 |
110 bool isBool(bool result) | 110 override bool isBool(bool result) |
111 { | 111 { |
112 return result ? true : false; | 112 return result ? true : false; |
113 } | 113 } |
114 | 114 |
115 void toCBuffer(OutBuffer buf, HdrGenState* hgs) | 115 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
116 { | 116 { |
117 buf.writestring("this"); | 117 buf.writestring("this"); |
118 } | 118 } |
119 | 119 |
120 version (DMDV2) { | 120 version (DMDV2) { |
121 int isLvalue() | 121 override int isLvalue() |
122 { | 122 { |
123 return 1; | 123 return 1; |
124 } | 124 } |
125 } | 125 } |
126 Expression toLvalue(Scope sc, Expression e) | 126 override Expression toLvalue(Scope sc, Expression e) |
127 { | 127 { |
128 return this; | 128 return this; |
129 } | 129 } |
130 | 130 |
131 void scanForNestedRef(Scope sc) | 131 override void scanForNestedRef(Scope sc) |
132 { | 132 { |
133 assert(false); | 133 assert(false); |
134 } | 134 } |
135 | 135 |
136 int inlineCost(InlineCostState* ics) | 136 override int inlineCost(InlineCostState* ics) |
137 { | 137 { |
138 FuncDeclaration fd = ics.fd; | 138 FuncDeclaration fd = ics.fd; |
139 if (!ics.hdrscan) | 139 if (!ics.hdrscan) |
140 if (fd.isNested() || !ics.hasthis) | 140 if (fd.isNested() || !ics.hasthis) |
141 return COST_MAX; | 141 return COST_MAX; |
142 | 142 |
143 return 1; | 143 return 1; |
144 } | 144 } |
145 | 145 |
146 Expression doInline(InlineDoState ids) | 146 override Expression doInline(InlineDoState ids) |
147 { | 147 { |
148 //if (!ids.vthis) | 148 //if (!ids.vthis) |
149 //error("no 'this' when inlining %s", ids.parent.toChars()); | 149 //error("no 'this' when inlining %s", ids.parent.toChars()); |
150 if (!ids.vthis) | 150 if (!ids.vthis) |
151 { | 151 { |
155 VarExp ve = new VarExp(loc, ids.vthis); | 155 VarExp ve = new VarExp(loc, ids.vthis); |
156 ve.type = type; | 156 ve.type = type; |
157 return ve; | 157 return ve; |
158 } | 158 } |
159 | 159 |
160 elem* toElem(IRState* irs) | 160 override elem* toElem(IRState* irs) |
161 { | 161 { |
162 elem* ethis; | 162 elem* ethis; |
163 FuncDeclaration fd; | 163 FuncDeclaration fd; |
164 | 164 |
165 //printf("ThisExp::toElem()\n"); | 165 //printf("ThisExp::toElem()\n"); |