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

Side by Side Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 1644683002: A missing enum case in a switch is a warning, not a compile-time error. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
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.generated.error_verifier; 5 library analyzer.src.generated.error_verifier;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 4262 matching lines...) Expand 10 before | Expand all | Expand 10 after
4273 } 4273 }
4274 } 4274 }
4275 int nameCount = constantNames.length; 4275 int nameCount = constantNames.length;
4276 if (nameCount == 0) { 4276 if (nameCount == 0) {
4277 return false; 4277 return false;
4278 } 4278 }
4279 for (int i = 0; i < nameCount; i++) { 4279 for (int i = 0; i < nameCount; i++) {
4280 int offset = statement.offset; 4280 int offset = statement.offset;
4281 int end = statement.rightParenthesis.end; 4281 int end = statement.rightParenthesis.end;
4282 _errorReporter.reportErrorForOffset( 4282 _errorReporter.reportErrorForOffset(
4283 CompileTimeErrorCode.MISSING_ENUM_CONSTANT_IN_SWITCH, 4283 StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH,
4284 offset, 4284 offset,
4285 end - offset, 4285 end - offset,
4286 [constantNames[i]]); 4286 [constantNames[i]]);
4287 } 4287 }
4288 return true; 4288 return true;
4289 } 4289 }
4290 4290
4291 /** 4291 /**
4292 * Verify that the given function [body] does not contain return statements 4292 * Verify that the given function [body] does not contain return statements
4293 * that both have and do not have return values. 4293 * that both have and do not have return values.
(...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after
6203 toCheck.add(type.element); 6203 toCheck.add(type.element);
6204 // type arguments 6204 // type arguments
6205 if (type is InterfaceType) { 6205 if (type is InterfaceType) {
6206 InterfaceType interfaceType = type; 6206 InterfaceType interfaceType = type;
6207 for (DartType typeArgument in interfaceType.typeArguments) { 6207 for (DartType typeArgument in interfaceType.typeArguments) {
6208 _addTypeToCheck(typeArgument); 6208 _addTypeToCheck(typeArgument);
6209 } 6209 }
6210 } 6210 }
6211 } 6211 }
6212 } 6212 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698