OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.dart.element.element; | 5 library analyzer.src.dart.element.element; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 2447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2458 */ | 2458 */ |
2459 static String _DEPRECATED_VARIABLE_NAME = "deprecated"; | 2459 static String _DEPRECATED_VARIABLE_NAME = "deprecated"; |
2460 | 2460 |
2461 /** | 2461 /** |
2462 * The name of the top-level variable used to mark a method as being a | 2462 * The name of the top-level variable used to mark a method as being a |
2463 * factory. | 2463 * factory. |
2464 */ | 2464 */ |
2465 static String _FACTORY_VARIABLE_NAME = "factory"; | 2465 static String _FACTORY_VARIABLE_NAME = "factory"; |
2466 | 2466 |
2467 /** | 2467 /** |
| 2468 * The name of the top-level variable used to mark a class and its subclasses |
| 2469 * as being immutable. |
| 2470 */ |
| 2471 static String _IMMUTABLE_VARIABLE_NAME = "immutable"; |
| 2472 |
| 2473 /** |
2468 * The name of the class used to JS annotate an element. | 2474 * The name of the class used to JS annotate an element. |
2469 */ | 2475 */ |
2470 static String _JS_CLASS_NAME = "JS"; | 2476 static String _JS_CLASS_NAME = "JS"; |
2471 | 2477 |
2472 /** | 2478 /** |
2473 * The name of `js` library, used to define JS annotations. | 2479 * The name of `js` library, used to define JS annotations. |
2474 */ | 2480 */ |
2475 static String _JS_LIB_NAME = "js"; | 2481 static String _JS_LIB_NAME = "js"; |
2476 | 2482 |
2477 /** | 2483 /** |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 return false; | 2583 return false; |
2578 } | 2584 } |
2579 | 2585 |
2580 @override | 2586 @override |
2581 bool get isFactory => | 2587 bool get isFactory => |
2582 element is PropertyAccessorElement && | 2588 element is PropertyAccessorElement && |
2583 element.name == _FACTORY_VARIABLE_NAME && | 2589 element.name == _FACTORY_VARIABLE_NAME && |
2584 element.library?.name == _META_LIB_NAME; | 2590 element.library?.name == _META_LIB_NAME; |
2585 | 2591 |
2586 @override | 2592 @override |
| 2593 bool get isImmutable => |
| 2594 element is PropertyAccessorElement && |
| 2595 element.name == _IMMUTABLE_VARIABLE_NAME && |
| 2596 element.library?.name == _META_LIB_NAME; |
| 2597 |
| 2598 @override |
2587 bool get isJS => | 2599 bool get isJS => |
2588 element is ConstructorElement && | 2600 element is ConstructorElement && |
2589 element.enclosingElement.name == _JS_CLASS_NAME && | 2601 element.enclosingElement.name == _JS_CLASS_NAME && |
2590 element.library?.name == _JS_LIB_NAME; | 2602 element.library?.name == _JS_LIB_NAME; |
2591 | 2603 |
2592 @override | 2604 @override |
2593 bool get isMustCallSuper => | 2605 bool get isMustCallSuper => |
2594 element is PropertyAccessorElement && | 2606 element is PropertyAccessorElement && |
2595 element.name == _MUST_CALL_SUPER_VARIABLE_NAME && | 2607 element.name == _MUST_CALL_SUPER_VARIABLE_NAME && |
2596 element.library?.name == _META_LIB_NAME; | 2608 element.library?.name == _META_LIB_NAME; |
(...skipping 6510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9107 | 9119 |
9108 @override | 9120 @override |
9109 void visitElement(Element element) { | 9121 void visitElement(Element element) { |
9110 int offset = element.nameOffset; | 9122 int offset = element.nameOffset; |
9111 if (offset != -1) { | 9123 if (offset != -1) { |
9112 map[offset] = element; | 9124 map[offset] = element; |
9113 } | 9125 } |
9114 super.visitElement(element); | 9126 super.visitElement(element); |
9115 } | 9127 } |
9116 } | 9128 } |
OLD | NEW |