OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 elements; | 5 library elements; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart' show Resolution; | 8 import '../common/resolution.dart' show Resolution; |
9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
10 import '../constants/constructors.dart'; | 10 import '../constants/constructors.dart'; |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 * | 583 * |
584 * For non-operator names, this method just returns its input. | 584 * For non-operator names, this method just returns its input. |
585 * | 585 * |
586 * The results returned from this method are guaranteed to be valid | 586 * The results returned from this method are guaranteed to be valid |
587 * JavaScript identifers, except it may include reserved words for | 587 * JavaScript identifers, except it may include reserved words for |
588 * non-operator names. | 588 * non-operator names. |
589 */ | 589 */ |
590 static String operatorNameToIdentifier(String name) { | 590 static String operatorNameToIdentifier(String name) { |
591 if (name == null) { | 591 if (name == null) { |
592 return name; | 592 return name; |
593 } else if (identical(name, '==')) { | 593 } else if (name == '==') { |
594 return r'operator$eq'; | 594 return r'operator$eq'; |
595 } else if (identical(name, '~')) { | 595 } else if (name == '~') { |
596 return r'operator$not'; | 596 return r'operator$not'; |
597 } else if (identical(name, '[]')) { | 597 } else if (name == '[]') { |
598 return r'operator$index'; | 598 return r'operator$index'; |
599 } else if (identical(name, '[]=')) { | 599 } else if (name == '[]=') { |
600 return r'operator$indexSet'; | 600 return r'operator$indexSet'; |
601 } else if (identical(name, '*')) { | 601 } else if (name == '*') { |
602 return r'operator$mul'; | 602 return r'operator$mul'; |
603 } else if (identical(name, '/')) { | 603 } else if (name == '/') { |
604 return r'operator$div'; | 604 return r'operator$div'; |
605 } else if (identical(name, '%')) { | 605 } else if (name == '%') { |
606 return r'operator$mod'; | 606 return r'operator$mod'; |
607 } else if (identical(name, '~/')) { | 607 } else if (name == '~/') { |
608 return r'operator$tdiv'; | 608 return r'operator$tdiv'; |
609 } else if (identical(name, '+')) { | 609 } else if (name == '+') { |
610 return r'operator$add'; | 610 return r'operator$add'; |
611 } else if (identical(name, '<<')) { | 611 } else if (name == '<<') { |
612 return r'operator$shl'; | 612 return r'operator$shl'; |
613 } else if (identical(name, '>>')) { | 613 } else if (name == '>>') { |
614 return r'operator$shr'; | 614 return r'operator$shr'; |
615 } else if (identical(name, '>=')) { | 615 } else if (name == '>=') { |
616 return r'operator$ge'; | 616 return r'operator$ge'; |
617 } else if (identical(name, '>')) { | 617 } else if (name == '>') { |
618 return r'operator$gt'; | 618 return r'operator$gt'; |
619 } else if (identical(name, '<=')) { | 619 } else if (name == '<=') { |
620 return r'operator$le'; | 620 return r'operator$le'; |
621 } else if (identical(name, '<')) { | 621 } else if (name == '<') { |
622 return r'operator$lt'; | 622 return r'operator$lt'; |
623 } else if (identical(name, '&')) { | 623 } else if (name == '&') { |
624 return r'operator$and'; | 624 return r'operator$and'; |
625 } else if (identical(name, '^')) { | 625 } else if (name == '^') { |
626 return r'operator$xor'; | 626 return r'operator$xor'; |
627 } else if (identical(name, '|')) { | 627 } else if (name == '|') { |
628 return r'operator$or'; | 628 return r'operator$or'; |
629 } else if (identical(name, '-')) { | 629 } else if (name == '-') { |
630 return r'operator$sub'; | 630 return r'operator$sub'; |
631 } else if (identical(name, 'unary-')) { | 631 } else if (name == 'unary-') { |
632 return r'operator$negate'; | 632 return r'operator$negate'; |
633 } else { | 633 } else { |
634 return name; | 634 return name; |
635 } | 635 } |
636 } | 636 } |
637 | 637 |
638 static String constructOperatorNameOrNull(String op, bool isUnary) { | 638 static String constructOperatorNameOrNull(String op, bool isUnary) { |
639 if (isMinusOperator(op)) { | 639 if (isMinusOperator(op)) { |
640 return isUnary ? 'unary-' : op; | 640 return isUnary ? 'unary-' : op; |
641 } else if (isUserDefinableOperator(op) || op == '??') { | 641 } else if (isUserDefinableOperator(op) || op == '??') { |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 /// by a field. | 1850 /// by a field. |
1851 bool get isDeclaredByField; | 1851 bool get isDeclaredByField; |
1852 | 1852 |
1853 /// Returns `true` if this member is abstract. | 1853 /// Returns `true` if this member is abstract. |
1854 bool get isAbstract; | 1854 bool get isAbstract; |
1855 | 1855 |
1856 /// If abstract, [implementation] points to the overridden concrete member, | 1856 /// If abstract, [implementation] points to the overridden concrete member, |
1857 /// if any. Otherwise [implementation] points to the member itself. | 1857 /// if any. Otherwise [implementation] points to the member itself. |
1858 Member get implementation; | 1858 Member get implementation; |
1859 } | 1859 } |
OLD | NEW |