OLD | NEW |
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 import '../elements/elements.dart'; | 7 import '../elements/elements.dart'; |
8 import '../universe/call_structure.dart' show CallStructure; | 8 import '../universe/call_structure.dart' show CallStructure; |
9 import '../universe/selector.dart' show Selector, SelectorKind; | 9 import '../universe/selector.dart' show Selector, SelectorKind; |
10 | 10 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 return XOR; | 423 return XOR; |
424 case '|=': | 424 case '|=': |
425 return OR; | 425 return OR; |
426 default: | 426 default: |
427 return null; | 427 return null; |
428 } | 428 } |
429 } | 429 } |
430 | 430 |
431 static AssignmentOperator fromKind(AssignmentOperatorKind kind) { | 431 static AssignmentOperator fromKind(AssignmentOperatorKind kind) { |
432 switch (kind) { | 432 switch (kind) { |
433 case AssignmentOperatorKind.ASSIGN: return ASSIGN; | 433 case AssignmentOperatorKind.ASSIGN: |
434 case AssignmentOperatorKind.IF_NULL: return IF_NULL; | 434 return ASSIGN; |
435 case AssignmentOperatorKind.ADD: return ADD; | 435 case AssignmentOperatorKind.IF_NULL: |
436 case AssignmentOperatorKind.SUB: return SUB; | 436 return IF_NULL; |
437 case AssignmentOperatorKind.MUL: return MUL; | 437 case AssignmentOperatorKind.ADD: |
438 case AssignmentOperatorKind.DIV: return DIV; | 438 return ADD; |
439 case AssignmentOperatorKind.IDIV: return IDIV; | 439 case AssignmentOperatorKind.SUB: |
440 case AssignmentOperatorKind.MOD: return MOD; | 440 return SUB; |
441 case AssignmentOperatorKind.SHL: return SHL; | 441 case AssignmentOperatorKind.MUL: |
442 case AssignmentOperatorKind.SHR: return SHR; | 442 return MUL; |
443 case AssignmentOperatorKind.AND: return AND; | 443 case AssignmentOperatorKind.DIV: |
444 case AssignmentOperatorKind.OR: return OR; | 444 return DIV; |
445 case AssignmentOperatorKind.XOR: return XOR; | 445 case AssignmentOperatorKind.IDIV: |
| 446 return IDIV; |
| 447 case AssignmentOperatorKind.MOD: |
| 448 return MOD; |
| 449 case AssignmentOperatorKind.SHL: |
| 450 return SHL; |
| 451 case AssignmentOperatorKind.SHR: |
| 452 return SHR; |
| 453 case AssignmentOperatorKind.AND: |
| 454 return AND; |
| 455 case AssignmentOperatorKind.OR: |
| 456 return OR; |
| 457 case AssignmentOperatorKind.XOR: |
| 458 return XOR; |
446 } | 459 } |
447 } | 460 } |
448 } | 461 } |
449 | 462 |
450 enum IncDecOperatorKind { INC, DEC } | 463 enum IncDecOperatorKind { INC, DEC } |
451 | 464 |
452 class IncDecOperator { | 465 class IncDecOperator { |
453 final IncDecOperatorKind kind; | 466 final IncDecOperatorKind kind; |
454 final String name; | 467 final String name; |
455 final BinaryOperator binaryOperator; | 468 final BinaryOperator binaryOperator; |
(...skipping 18 matching lines...) Expand all Loading... |
474 return INC; | 487 return INC; |
475 case '--': | 488 case '--': |
476 return DEC; | 489 return DEC; |
477 default: | 490 default: |
478 return null; | 491 return null; |
479 } | 492 } |
480 } | 493 } |
481 | 494 |
482 static IncDecOperator fromKind(IncDecOperatorKind kind) { | 495 static IncDecOperator fromKind(IncDecOperatorKind kind) { |
483 switch (kind) { | 496 switch (kind) { |
484 case IncDecOperatorKind.INC: return INC; | 497 case IncDecOperatorKind.INC: |
485 case IncDecOperatorKind.DEC: return DEC; | 498 return INC; |
| 499 case IncDecOperatorKind.DEC: |
| 500 return DEC; |
486 } | 501 } |
487 } | 502 } |
488 } | 503 } |
OLD | NEW |