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

Side by Side Diff: pkg/analyzer/lib/src/summary/link.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 | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/lib/src/summary/summarize_ast.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /** 5 /**
6 * This library is capable of producing linked summaries from unlinked 6 * This library is capable of producing linked summaries from unlinked
7 * ones (or prelinked ones). It functions by building a miniature 7 * ones (or prelinked ones). It functions by building a miniature
8 * element model to represent the contents of the summaries, and then 8 * element model to represent the contents of the summaries, and then
9 * scanning the element model to gather linked information and adding 9 * scanning the element model to gather linked information and adding
10 * it to the summary data structures. 10 * it to the summary data structures.
(...skipping 4317 matching lines...) Expand 10 before | Expand all | Expand 10 after
4328 * implied by a field or variable declaration. 4328 * implied by a field or variable declaration.
4329 */ 4329 */
4330 class PropertyAccessorElementForLink_Variable extends Object 4330 class PropertyAccessorElementForLink_Variable extends Object
4331 with ReferenceableElementForLink 4331 with ReferenceableElementForLink
4332 implements PropertyAccessorElementForLink { 4332 implements PropertyAccessorElementForLink {
4333 @override 4333 @override
4334 final bool isSetter; 4334 final bool isSetter;
4335 4335
4336 final VariableElementForLink variable; 4336 final VariableElementForLink variable;
4337 FunctionTypeImpl _type; 4337 FunctionTypeImpl _type;
4338 ParameterElementForLink_VariableSetter _parameter;
4338 List<ParameterElement> _parameters; 4339 List<ParameterElement> _parameters;
4339 4340
4340 PropertyAccessorElementForLink_Variable(this.variable, this.isSetter); 4341 PropertyAccessorElementForLink_Variable(this.variable, this.isSetter);
4341 4342
4342 @override 4343 @override
4343 ConstVariableNode get asConstVariable => variable._constNode; 4344 ConstVariableNode get asConstVariable => variable._constNode;
4344 4345
4345 @override 4346 @override
4346 DartType get asStaticType => returnType; 4347 DartType get asStaticType => returnType;
4347 4348
(...skipping 23 matching lines...) Expand all
4371 variable.compilationUnit.enclosingElement; 4372 variable.compilationUnit.enclosingElement;
4372 4373
4373 @override 4374 @override
4374 String get name => isSetter ? '${variable.name}=' : variable.name; 4375 String get name => isSetter ? '${variable.name}=' : variable.name;
4375 4376
4376 @override 4377 @override
4377 List<ParameterElement> get parameters { 4378 List<ParameterElement> get parameters {
4378 if (_parameters == null) { 4379 if (_parameters == null) {
4379 _parameters = <ParameterElementForLink_VariableSetter>[]; 4380 _parameters = <ParameterElementForLink_VariableSetter>[];
4380 if (isSetter) { 4381 if (isSetter) {
4381 _parameters.add(new ParameterElementForLink_VariableSetter(this)); 4382 _parameter = new ParameterElementForLink_VariableSetter(this);
4383 _parameters.add(_parameter);
4382 } 4384 }
4383 } 4385 }
4384 return _parameters; 4386 return _parameters;
4385 } 4387 }
4386 4388
4387 @override 4389 @override
4388 DartType get returnType { 4390 DartType get returnType {
4389 if (isSetter) { 4391 if (isSetter) {
4390 return VoidTypeImpl.instance; 4392 return VoidTypeImpl.instance;
4391 } else { 4393 } else {
(...skipping 22 matching lines...) Expand all
4414 } else { 4416 } else {
4415 return null; 4417 return null;
4416 } 4418 }
4417 } 4419 }
4418 4420
4419 @override 4421 @override
4420 bool isAccessibleIn(LibraryElement library) => 4422 bool isAccessibleIn(LibraryElement library) =>
4421 !Identifier.isPrivateName(name) || identical(this.library, library); 4423 !Identifier.isPrivateName(name) || identical(this.library, library);
4422 4424
4423 @override 4425 @override
4424 void link(CompilationUnitElementInBuildUnit compilationUnit) {} 4426 void link(CompilationUnitElementInBuildUnit compilationUnit) {
4427 if (isSetter && _parameter != null) {
4428 if (_parameter.inheritsCovariant) {
4429 compilationUnit._storeInheritsCovariant(
4430 variable.unlinkedVariable.inheritsCovariantSlot);
4431 }
4432 }
4433 }
4425 4434
4426 @override 4435 @override
4427 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 4436 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
4428 4437
4429 @override 4438 @override
4430 String toString() => '$enclosingElement.$name'; 4439 String toString() => '$enclosingElement.$name';
4431 } 4440 }
4432 4441
4433 /** 4442 /**
4434 * Base class representing an element which can be the target of a reference. 4443 * Base class representing an element which can be the target of a reference.
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
5116 } 5125 }
5117 5126
5118 /** 5127 /**
5119 * This exception is thrown when [ExprTypeComputer] cannot inference the type. 5128 * This exception is thrown when [ExprTypeComputer] cannot inference the type.
5120 */ 5129 */
5121 class _InferenceFailedError { 5130 class _InferenceFailedError {
5122 final String message; 5131 final String message;
5123 5132
5124 _InferenceFailedError(this.message); 5133 _InferenceFailedError(this.message);
5125 } 5134 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/idl.dart ('k') | pkg/analyzer/lib/src/summary/summarize_ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698