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

Side by Side Diff: pkg/analyzer/lib/src/task/strong_mode.dart

Issue 1850623005: Issue 26147. Don't attempt to set the type of the parameter for setters without parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/test/src/task/strong_mode_test.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.task.strong_mode; 5 library analyzer.src.task.strong_mode;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 11 matching lines...) Expand all
22 * synthetic getter/setter types. 22 * synthetic getter/setter types.
23 */ 23 */
24 void setFieldType(VariableElement field, DartType newType) { 24 void setFieldType(VariableElement field, DartType newType) {
25 (field as VariableElementImpl).type = newType; 25 (field as VariableElementImpl).type = newType;
26 if (field.initializer != null) { 26 if (field.initializer != null) {
27 (field.initializer as ExecutableElementImpl).returnType = newType; 27 (field.initializer as ExecutableElementImpl).returnType = newType;
28 } 28 }
29 if (field is PropertyInducingElementImpl) { 29 if (field is PropertyInducingElementImpl) {
30 (field.getter as ExecutableElementImpl).returnType = newType; 30 (field.getter as ExecutableElementImpl).returnType = newType;
31 if (!field.isFinal && !field.isConst) { 31 if (!field.isFinal && !field.isConst) {
32 (field.setter.parameters[0] as ParameterElementImpl).type = newType; 32 List<ParameterElement> setterParameters = field.setter.parameters;
33 if (setterParameters.isNotEmpty) {
34 (setterParameters[0] as ParameterElementImpl).type = newType;
35 }
33 } 36 }
34 } 37 }
35 } 38 }
36 39
37 /** 40 /**
38 * Return the element for the single parameter of the given [setter], or `null` 41 * Return the element for the single parameter of the given [setter], or `null`
39 * if the executable element is not a setter or does not have a single 42 * if the executable element is not a setter or does not have a single
40 * parameter. 43 * parameter.
41 */ 44 */
42 ParameterElement _getParameter(ExecutableElement setter) { 45 ParameterElement _getParameter(ExecutableElement setter) {
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 results.add(element); 476 results.add(element);
474 } 477 }
475 } 478 }
476 } 479 }
477 } 480 }
478 481
479 /** 482 /**
480 * A class of exception that is not used anywhere else. 483 * A class of exception that is not used anywhere else.
481 */ 484 */
482 class _CycleException implements Exception {} 485 class _CycleException implements Exception {}
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/strong_mode_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698