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

Unified 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, 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/strong_mode.dart
diff --git a/pkg/analyzer/lib/src/task/strong_mode.dart b/pkg/analyzer/lib/src/task/strong_mode.dart
index 0ab8a8bbff15dd5850f1a372a2a74ef9f3050c92..3d621cf0043670395b1f96baf494069035793162 100644
--- a/pkg/analyzer/lib/src/task/strong_mode.dart
+++ b/pkg/analyzer/lib/src/task/strong_mode.dart
@@ -29,7 +29,10 @@ void setFieldType(VariableElement field, DartType newType) {
if (field is PropertyInducingElementImpl) {
(field.getter as ExecutableElementImpl).returnType = newType;
if (!field.isFinal && !field.isConst) {
- (field.setter.parameters[0] as ParameterElementImpl).type = newType;
+ List<ParameterElement> setterParameters = field.setter.parameters;
+ if (setterParameters.isNotEmpty) {
+ (setterParameters[0] as ParameterElementImpl).type = newType;
+ }
}
}
}
« 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