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

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

Issue 2757143002: The parameter of synthetic setters should inherit 'covariant'. (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/format.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.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 7782 matching lines...) Expand 10 before | Expand all | Expand 10 after
7793 ParameterElementImpl_ofImplicitSetter( 7793 ParameterElementImpl_ofImplicitSetter(
7794 PropertyAccessorElementImpl_ImplicitSetter setter) 7794 PropertyAccessorElementImpl_ImplicitSetter setter)
7795 : setter = setter, 7795 : setter = setter,
7796 super('_${setter.variable.name}', setter.variable.nameOffset) { 7796 super('_${setter.variable.name}', setter.variable.nameOffset) {
7797 enclosingElement = setter; 7797 enclosingElement = setter;
7798 isSynthetic = true; 7798 isSynthetic = true;
7799 parameterKind = ParameterKind.REQUIRED; 7799 parameterKind = ParameterKind.REQUIRED;
7800 } 7800 }
7801 7801
7802 @override 7802 @override
7803 bool get inheritsCovariant {
7804 PropertyInducingElement variable = setter.variable;
7805 if (variable is FieldElementImpl && variable._unlinkedVariable != null) {
7806 return enclosingUnit.resynthesizerContext
7807 .inheritsCovariant(variable._unlinkedVariable.inheritsCovariantSlot);
7808 }
7809 return super.inheritsCovariant;
7810 }
7811
7812 @override
7803 bool get isCovariant { 7813 bool get isCovariant {
7804 if (isExplicitlyCovariant || inheritsCovariant) { 7814 if (isExplicitlyCovariant || inheritsCovariant) {
7805 return true; 7815 return true;
7806 } 7816 }
7807 for (ElementAnnotationImpl annotation in setter.variable.metadata) { 7817 for (ElementAnnotationImpl annotation in setter.variable.metadata) {
7808 if (annotation.isCovariant) { 7818 if (annotation.isCovariant) {
7809 return true; 7819 return true;
7810 } 7820 }
7811 } 7821 }
7812 return false; 7822 return false;
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
9041 9051
9042 @override 9052 @override
9043 void visitElement(Element element) { 9053 void visitElement(Element element) {
9044 int offset = element.nameOffset; 9054 int offset = element.nameOffset;
9045 if (offset != -1) { 9055 if (offset != -1) {
9046 map[offset] = element; 9056 map[offset] = element;
9047 } 9057 }
9048 super.visitElement(element); 9058 super.visitElement(element);
9049 } 9059 }
9050 } 9060 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/format.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698