Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(838)

Unified Diff: pkg/analyzer/lib/src/generated/element.dart

Issue 946023003: Fix for searching constructor references. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/generated/element.dart
diff --git a/pkg/analyzer/lib/src/generated/element.dart b/pkg/analyzer/lib/src/generated/element.dart
index f160505e2e4923fb26fc6f0d5c511ed953e32a3d..bcd681f1f41830e200603099f9a76fe87b5e32da 100644
--- a/pkg/analyzer/lib/src/generated/element.dart
+++ b/pkg/analyzer/lib/src/generated/element.dart
@@ -9,6 +9,8 @@ library engine.element;
import 'dart:collection';
+import 'package:analyzer/src/generated/utilities_general.dart';
+
import 'ast.dart';
import 'constant.dart' show EvaluationResultImpl;
import 'engine.dart' show AnalysisContext, AnalysisEngine, AnalysisException;
@@ -21,7 +23,6 @@ import 'sdk.dart' show DartSdk;
import 'source.dart';
import 'utilities_collection.dart';
import 'utilities_dart.dart';
-import 'package:analyzer/src/generated/utilities_general.dart';
/**
@@ -1676,6 +1677,12 @@ abstract class ConstructorElement implements ClassMemberElement,
bool get isFactory;
/**
+ * Return the offset of the character immediately following the last character
+ * of this constructor's name, or `null` if not named.
+ */
+ int get nameEnd;
+
+ /**
* Return the resolved [ConstructorDeclaration] node that declares this
* [ConstructorElement] .
*
@@ -1688,6 +1695,12 @@ abstract class ConstructorElement implements ClassMemberElement,
ConstructorDeclaration get node;
/**
+ * Return the offset of the `.` before this constructor name, or `null` if
+ * not named.
+ */
+ int get periodOffset;
+
+ /**
* Return the constructor to which this constructor is redirecting, or `null` if this
* constructor does not redirect to another constructor or if the library containing this
* constructor has not yet been resolved.
@@ -1721,6 +1734,17 @@ class ConstructorElementImpl extends ExecutableElementImpl implements
List<ConstructorInitializer> constantInitializers;
/**
+ * The offset of the `.` before this constructor name or `null` if not named.
+ */
+ int periodOffset;
+
+ /**
+ * Return the offset of the character immediately following the last character
+ * of this constructor's name, or `null` if not named.
+ */
+ int nameEnd;
+
+ /**
* Initialize a newly created constructor element to have the given name.
*
* @param name the name of this element
@@ -1851,9 +1875,15 @@ class ConstructorMember extends ExecutableMember implements ConstructorElement {
bool get isFactory => baseElement.isFactory;
@override
+ int get nameEnd => baseElement.nameEnd;
+
+ @override
ConstructorDeclaration get node => baseElement.node;
@override
+ int get periodOffset => baseElement.periodOffset;
+
+ @override
ConstructorElement get redirectedConstructor =>
from(baseElement.redirectedConstructor, definingType);
@@ -4805,34 +4835,6 @@ class FunctionTypeImpl extends TypeImpl implements FunctionType {
int get hashCode => internalHashCode(<DartType>[]);
@override
- int internalHashCode(List<DartType> visitedTypes) {
- if (element == null) {
- return 0;
- } else if (visitedTypes.contains(this)) {
- return 3;
- }
- visitedTypes.add(this);
- // Reference the arrays of parameters
- List<DartType> normalParameterTypes = this.normalParameterTypes;
- List<DartType> optionalParameterTypes = this.optionalParameterTypes;
- Iterable<DartType> namedParameterTypes = this.namedParameterTypes.values;
- // Generate the hashCode
- int code = (returnType as TypeImpl).internalHashCode(visitedTypes);
- for (int i = 0; i < normalParameterTypes.length; i++) {
- code = (code << 1) +
- (normalParameterTypes[i] as TypeImpl).internalHashCode(visitedTypes);
- }
- for (int i = 0; i < optionalParameterTypes.length; i++) {
- code = (code << 1) +
- (optionalParameterTypes[i] as TypeImpl).internalHashCode(visitedTypes);
- }
- for (DartType type in namedParameterTypes) {
- code = (code << 1) + (type as TypeImpl).internalHashCode(visitedTypes);
- }
- return code;
- }
-
- @override
Map<String, DartType> get namedParameterTypes {
LinkedHashMap<String, DartType> namedParameterTypes =
new LinkedHashMap<String, DartType>();
@@ -5056,6 +5058,34 @@ class FunctionTypeImpl extends TypeImpl implements FunctionType {
}
@override
+ int internalHashCode(List<DartType> visitedTypes) {
+ if (element == null) {
+ return 0;
+ } else if (visitedTypes.contains(this)) {
+ return 3;
+ }
+ visitedTypes.add(this);
+ // Reference the arrays of parameters
+ List<DartType> normalParameterTypes = this.normalParameterTypes;
+ List<DartType> optionalParameterTypes = this.optionalParameterTypes;
+ Iterable<DartType> namedParameterTypes = this.namedParameterTypes.values;
+ // Generate the hashCode
+ int code = (returnType as TypeImpl).internalHashCode(visitedTypes);
+ for (int i = 0; i < normalParameterTypes.length; i++) {
+ code = (code << 1) +
+ (normalParameterTypes[i] as TypeImpl).internalHashCode(visitedTypes);
+ }
+ for (int i = 0; i < optionalParameterTypes.length; i++) {
+ code = (code << 1) +
+ (optionalParameterTypes[i] as TypeImpl).internalHashCode(visitedTypes);
+ }
+ for (DartType type in namedParameterTypes) {
+ code = (code << 1) + (type as TypeImpl).internalHashCode(visitedTypes);
+ }
+ return code;
+ }
+
+ @override
bool internalIsMoreSpecificThan(DartType type, bool withDynamic,
Set<TypeImpl_TypePair> visitedTypePairs) {
// trivial base cases
@@ -6275,9 +6305,6 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
}
@override
- int internalHashCode(List<DartType> visitedTypes) => hashCode;
-
- @override
List<InterfaceType> get interfaces {
ClassElement classElement = element;
List<InterfaceType> interfaces = classElement.interfaces;
@@ -6463,6 +6490,9 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
}
@override
+ int internalHashCode(List<DartType> visitedTypes) => hashCode;
+
+ @override
bool internalIsMoreSpecificThan(DartType type, bool withDynamic,
Set<TypeImpl_TypePair> visitedTypePairs) {
//
@@ -10619,9 +10649,6 @@ class UnionTypeImpl extends TypeImpl implements UnionType {
int get hashCode => _types.hashCode;
@override
- int internalHashCode(List<DartType> visitedTypes) => hashCode;
-
- @override
bool operator ==(Object other) {
if (other == null || other is! UnionType) {
return false;
@@ -10652,6 +10679,9 @@ class UnionTypeImpl extends TypeImpl implements UnionType {
this == object;
@override
+ int internalHashCode(List<DartType> visitedTypes) => hashCode;
+
+ @override
bool internalIsMoreSpecificThan(DartType type, bool withDynamic,
Set<TypeImpl_TypePair> visitedTypePairs) {
// What version of subtyping do we want? See discussion below in
@@ -11130,9 +11160,6 @@ class VoidTypeImpl extends TypeImpl implements VoidType {
int get hashCode => 2;
@override
- int internalHashCode(List<DartType> visitedTypes) => hashCode;
-
- @override
bool get isVoid => true;
@override
@@ -11143,6 +11170,9 @@ class VoidTypeImpl extends TypeImpl implements VoidType {
identical(object, this);
@override
+ int internalHashCode(List<DartType> visitedTypes) => hashCode;
+
+ @override
bool internalIsMoreSpecificThan(DartType type, bool withDynamic,
Set<TypeImpl_TypePair> visitedTypePairs) =>
isSubtypeOf(type);
« no previous file with comments | « pkg/analysis_server/test/services/search/search_engine_test.dart ('k') | pkg/analyzer/lib/src/generated/element_handle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698