Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(738)

Side by Side Diff: pkg/compiler/lib/src/resolution/operators.dart

Issue 1004683002: Refactor IrBuilder to use SemanticVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. initial comments + bug fixes Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.operators; 5 library dart2js.operators;
6 6
7 enum UnaryOperatorKind { 7 enum UnaryOperatorKind {
8 NOT, 8 NOT,
9 NEGATE, 9 NEGATE,
10 COMPLEMENT, 10 COMPLEMENT,
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 class AssignmentOperator { 199 class AssignmentOperator {
200 final AssignmentOperatorKind kind; 200 final AssignmentOperatorKind kind;
201 final BinaryOperator binaryOperator; 201 final BinaryOperator binaryOperator;
202 final String name; 202 final String name;
203 final bool isUserDefinable; 203 final bool isUserDefinable;
204 204
205 const AssignmentOperator._(this.kind, this.name, this.binaryOperator, 205 const AssignmentOperator._(this.kind, this.name, this.binaryOperator,
206 {this.isUserDefinable: true}); 206 {this.isUserDefinable: true});
207 207
208 String get selectorName {
209 return binaryOperator != null ? binaryOperator.selectorName: null;
210 }
211
208 String toString() => name; 212 String toString() => name;
209 213
210 /// The = operator. 214 /// The = operator.
211 static const AssignmentOperator ASSIGN = 215 static const AssignmentOperator ASSIGN =
212 const AssignmentOperator._(AssignmentOperatorKind.ASSIGN, '=', 216 const AssignmentOperator._(AssignmentOperatorKind.ASSIGN, '=',
213 null, isUserDefinable: false); 217 null, isUserDefinable: false);
214 218
215 /// The += assignment operator. 219 /// The += assignment operator.
216 static const AssignmentOperator ADD = 220 static const AssignmentOperator ADD =
217 const AssignmentOperator._(AssignmentOperatorKind.ADD, '+=', 221 const AssignmentOperator._(AssignmentOperatorKind.ADD, '+=',
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 } 291 }
288 292
289 293
290 enum IncDecOperatorKind { 294 enum IncDecOperatorKind {
291 INC, DEC 295 INC, DEC
292 } 296 }
293 297
294 class IncDecOperator { 298 class IncDecOperator {
295 final IncDecOperatorKind kind; 299 final IncDecOperatorKind kind;
296 final String name; 300 final String name;
301 final BinaryOperator binaryOperator;
297 302
298 const IncDecOperator._(this.kind, this.name); 303 const IncDecOperator._(this.kind, this.name, this.binaryOperator);
304
305 String get selectorName => binaryOperator.selectorName;
299 306
300 String toString() => name; 307 String toString() => name;
301 308
302 /// The prefix/postfix ++ operator. 309 /// The prefix/postfix ++ operator.
303 static const IncDecOperator INC = 310 static const IncDecOperator INC =
304 const IncDecOperator._(IncDecOperatorKind.INC, '++'); 311 const IncDecOperator._(IncDecOperatorKind.INC, '++', BinaryOperator.ADD);
305 312
306 /// The prefix/postfix -- operator. 313 /// The prefix/postfix -- operator.
307 static const IncDecOperator DEC = 314 static const IncDecOperator DEC =
308 const IncDecOperator._(IncDecOperatorKind.DEC, '--'); 315 const IncDecOperator._(IncDecOperatorKind.DEC, '--', BinaryOperator.SUB);
309 316
310 static IncDecOperator parse(String value) { 317 static IncDecOperator parse(String value) {
311 switch (value) { 318 switch (value) {
312 case '++': return INC; 319 case '++': return INC;
313 case '--': return DEC; 320 case '--': return DEC;
314 default: return null; 321 default: return null;
315 } 322 }
316 } 323 }
317 } 324 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698