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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/member.dart

Issue 2375373002: fix #27040, promote the upper bound of a type parameter (Closed)
Patch Set: guard Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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.member; 5 library analyzer.src.dart.element.member;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/constant/value.dart'; 8 import 'package:analyzer/dart/constant/value.dart';
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 @override 916 @override
917 Element get enclosingElement => baseElement.enclosingElement; 917 Element get enclosingElement => baseElement.enclosingElement;
918 918
919 @override 919 @override
920 int get hashCode => baseElement.hashCode; 920 int get hashCode => baseElement.hashCode;
921 921
922 @override 922 @override
923 TypeParameterType get type => _type; 923 TypeParameterType get type => _type;
924 924
925 @override 925 @override
926 bool operator ==(obj) =>
927 // TODO(jmesserly): this equality should consider the bound, see:
928 // https://github.com/dart-lang/sdk/issues/27210
929 obj is TypeParameterMember && obj.baseElement == baseElement;
930
931 @override
932 accept(ElementVisitor visitor) => visitor.visitTypeParameterElement(this); 926 accept(ElementVisitor visitor) => visitor.visitTypeParameterElement(this);
933 927
934 /** 928 /**
935 * If the given [parameter]'s type is different when any type parameters from 929 * If the given [parameter]'s type is different when any type parameters from
936 * the defining type's declaration are replaced with the actual type 930 * the defining type's declaration are replaced with the actual type
937 * arguments from the [definingType], create a parameter member representing 931 * arguments from the [definingType], create a parameter member representing
938 * the given parameter. Return the member that was created, or the base 932 * the given parameter. Return the member that was created, or the base
939 * parameter if no member was created. 933 * parameter if no member was created.
940 */ 934 */
941 static TypeParameterElement from( 935 static TypeParameterElement from(
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 DartObject computeConstantValue() => baseElement.computeConstantValue(); 1015 DartObject computeConstantValue() => baseElement.computeConstantValue();
1022 1016
1023 @override 1017 @override
1024 void visitChildren(ElementVisitor visitor) { 1018 void visitChildren(ElementVisitor visitor) {
1025 // TODO(brianwilkerson) We need to finish implementing the accessors used 1019 // TODO(brianwilkerson) We need to finish implementing the accessors used
1026 // below so that we can safely invoke them. 1020 // below so that we can safely invoke them.
1027 super.visitChildren(visitor); 1021 super.visitChildren(visitor);
1028 baseElement.initializer?.accept(visitor); 1022 baseElement.initializer?.accept(visitor);
1029 } 1023 }
1030 } 1024 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698