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 '../constants/constructors.dart'; | 9 import '../constants/constructors.dart'; |
10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 static bool isOperatorName(String name) { | 550 static bool isOperatorName(String name) { |
551 return name == 'unary-' || isUserDefinableOperator(name); | 551 return name == 'unary-' || isUserDefinableOperator(name); |
552 } | 552 } |
553 | 553 |
554 /** | 554 /** |
555 * Map an operator-name to a valid JavaScript identifier. | 555 * Map an operator-name to a valid JavaScript identifier. |
556 * | 556 * |
557 * For non-operator names, this method just returns its input. | 557 * For non-operator names, this method just returns its input. |
558 * | 558 * |
559 * The results returned from this method are guaranteed to be valid | 559 * The results returned from this method are guaranteed to be valid |
560 * JavaScript identifers, except it may include reserved words for | 560 * JavaScript identifiers, except it may include reserved words for |
561 * non-operator names. | 561 * non-operator names. |
562 */ | 562 */ |
563 static String operatorNameToIdentifier(String name) { | 563 static String operatorNameToIdentifier(String name) { |
564 if (name == null) { | 564 if (name == null) { |
565 return name; | 565 return name; |
566 } else if (name == '==') { | 566 } else if (name == '==') { |
567 return r'operator$eq'; | 567 return r'operator$eq'; |
568 } else if (name == '~') { | 568 } else if (name == '~') { |
569 return r'operator$not'; | 569 return r'operator$not'; |
570 } else if (name == '[]') { | 570 } else if (name == '[]') { |
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 /// return type and argument type, respectively. For methods the type is the | 1816 /// return type and argument type, respectively. For methods the type is the |
1817 /// [functionType] defined by the return type and parameters. | 1817 /// [functionType] defined by the return type and parameters. |
1818 ResolutionDartType get type; | 1818 ResolutionDartType get type; |
1819 | 1819 |
1820 /// The function type of the member. For a getter `Foo get foo` this is | 1820 /// The function type of the member. For a getter `Foo get foo` this is |
1821 /// `() -> Foo`, for a setter `void set foo(Foo _)` this is `(Foo) -> void`. | 1821 /// `() -> Foo`, for a setter `void set foo(Foo _)` this is `(Foo) -> void`. |
1822 /// For methods the function type is defined by the return type and | 1822 /// For methods the function type is defined by the return type and |
1823 /// parameters. | 1823 /// parameters. |
1824 ResolutionFunctionType get functionType; | 1824 ResolutionFunctionType get functionType; |
1825 | 1825 |
1826 /// Returns `true` if this member is a getter, possibly implictly defined by a | 1826 /// Returns `true` if this member is a getter, possibly implicitly defined by
a |
1827 /// field declaration. | 1827 /// field declaration. |
1828 bool get isGetter; | 1828 bool get isGetter; |
1829 | 1829 |
1830 /// Returns `true` if this member is a setter, possibly implictly defined by a | 1830 /// Returns `true` if this member is a setter, possibly implicitly defined by
a |
1831 /// field declaration. | 1831 /// field declaration. |
1832 bool get isSetter; | 1832 bool get isSetter; |
1833 | 1833 |
1834 /// Returns `true` if this member is a method, that is neither a getter nor | 1834 /// Returns `true` if this member is a method, that is neither a getter nor |
1835 /// setter. | 1835 /// setter. |
1836 bool get isMethod; | 1836 bool get isMethod; |
1837 | 1837 |
1838 /// Returns an iterable of the declarations that define this member. | 1838 /// Returns an iterable of the declarations that define this member. |
1839 Iterable<Member> get declarations; | 1839 Iterable<Member> get declarations; |
1840 } | 1840 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1872 /// by a field. | 1872 /// by a field. |
1873 bool get isDeclaredByField; | 1873 bool get isDeclaredByField; |
1874 | 1874 |
1875 /// Returns `true` if this member is abstract. | 1875 /// Returns `true` if this member is abstract. |
1876 bool get isAbstract; | 1876 bool get isAbstract; |
1877 | 1877 |
1878 /// If abstract, [implementation] points to the overridden concrete member, | 1878 /// If abstract, [implementation] points to the overridden concrete member, |
1879 /// if any. Otherwise [implementation] points to the member itself. | 1879 /// if any. Otherwise [implementation] points to the member itself. |
1880 Member get implementation; | 1880 Member get implementation; |
1881 } | 1881 } |
OLD | NEW |