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 7510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7521 | 7521 |
7522 /** | 7522 /** |
7523 * Set whether this accessor is a getter. | 7523 * Set whether this accessor is a getter. |
7524 */ | 7524 */ |
7525 void set getter(bool isGetter) { | 7525 void set getter(bool isGetter) { |
7526 assert(serializedExecutable == null); | 7526 assert(serializedExecutable == null); |
7527 setModifier(Modifier.GETTER, isGetter); | 7527 setModifier(Modifier.GETTER, isGetter); |
7528 } | 7528 } |
7529 | 7529 |
7530 @override | 7530 @override |
7531 int get hashCode => JenkinsSmiHash.hash2(super.hashCode, isGetter ? 1 : 2); | |
7532 | |
7533 @override | |
7534 String get identifier { | 7531 String get identifier { |
7535 String name = displayName; | 7532 String name = displayName; |
7536 String suffix = isGetter ? "?" : "="; | 7533 String suffix = isGetter ? "?" : "="; |
7537 return "$name$suffix"; | 7534 return "$name$suffix"; |
7538 } | 7535 } |
7539 | 7536 |
7540 @override | 7537 @override |
7541 bool get isGetter { | 7538 bool get isGetter { |
7542 if (serializedExecutable != null) { | 7539 if (serializedExecutable != null) { |
7543 return serializedExecutable.kind == UnlinkedExecutableKind.getter; | 7540 return serializedExecutable.kind == UnlinkedExecutableKind.getter; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7591 | 7588 |
7592 /** | 7589 /** |
7593 * Set whether this accessor is static. | 7590 * Set whether this accessor is static. |
7594 */ | 7591 */ |
7595 void set static(bool isStatic) { | 7592 void set static(bool isStatic) { |
7596 assert(serializedExecutable == null); | 7593 assert(serializedExecutable == null); |
7597 setModifier(Modifier.STATIC, isStatic); | 7594 setModifier(Modifier.STATIC, isStatic); |
7598 } | 7595 } |
7599 | 7596 |
7600 @override | 7597 @override |
7601 bool operator ==(Object object) => | |
7602 super == object && | |
7603 isGetter == (object as PropertyAccessorElement).isGetter; | |
7604 | |
7605 @override | |
7606 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); | 7598 accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this); |
7607 | 7599 |
7608 @override | 7600 @override |
7609 void appendTo(StringBuffer buffer) { | 7601 void appendTo(StringBuffer buffer) { |
7610 buffer.write(isGetter ? "get " : "set "); | 7602 buffer.write(isGetter ? "get " : "set "); |
7611 buffer.write(variable.displayName); | 7603 buffer.write(variable.displayName); |
7612 super.appendTo(buffer); | 7604 super.appendTo(buffer); |
7613 } | 7605 } |
7614 | 7606 |
7615 @override | 7607 @override |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8448 | 8440 |
8449 @override | 8441 @override |
8450 void visitElement(Element element) { | 8442 void visitElement(Element element) { |
8451 int offset = element.nameOffset; | 8443 int offset = element.nameOffset; |
8452 if (offset != -1) { | 8444 if (offset != -1) { |
8453 map[offset] = element; | 8445 map[offset] = element; |
8454 } | 8446 } |
8455 super.visitElement(element); | 8447 super.visitElement(element); |
8456 } | 8448 } |
8457 } | 8449 } |
OLD | NEW |