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

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

Issue 2813553006: Split error code to ease future improvements (Closed)
Patch Set: Created 3 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
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.resolver; 5 library analyzer.src.generated.resolver;
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/standard_resolution_map.dart'; 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
(...skipping 7139 matching lines...) Expand 10 before | Expand all | Expand 10 after
7150 if (positionalArgumentCount < requiredParameterCount && noBlankArguments) { 7150 if (positionalArgumentCount < requiredParameterCount && noBlankArguments) {
7151 ErrorCode errorCode = (reportAsError 7151 ErrorCode errorCode = (reportAsError
7152 ? CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS 7152 ? CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS
7153 : StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS); 7153 : StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS);
7154 if (onError != null) { 7154 if (onError != null) {
7155 onError(errorCode, argumentList, 7155 onError(errorCode, argumentList,
7156 [requiredParameterCount, positionalArgumentCount]); 7156 [requiredParameterCount, positionalArgumentCount]);
7157 } 7157 }
7158 } else if (positionalArgumentCount > unnamedParameterCount && 7158 } else if (positionalArgumentCount > unnamedParameterCount &&
7159 noBlankArguments) { 7159 noBlankArguments) {
7160 ErrorCode errorCode = (reportAsError 7160 ErrorCode errorCode;
7161 ? CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS 7161 int namedParameterCount = namedParameters?.length ?? 0;
7162 : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS); 7162 int namedArgumentCount = usedNames?.length ?? 0;
7163 if (namedParameterCount > namedArgumentCount) {
7164 errorCode = (reportAsError
7165 ? CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED
7166 : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS_COULD_BE_NAMED);
7167 } else {
7168 errorCode = (reportAsError
7169 ? CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS
7170 : StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS);
7171 }
7163 if (onError != null) { 7172 if (onError != null) {
7164 onError(errorCode, argumentList, 7173 onError(errorCode, argumentList,
7165 [unnamedParameterCount, positionalArgumentCount]); 7174 [unnamedParameterCount, positionalArgumentCount]);
7166 } 7175 }
7167 } 7176 }
7168 return resolvedParameters; 7177 return resolvedParameters;
7169 } 7178 }
7170 } 7179 }
7171 7180
7172 /** 7181 /**
(...skipping 3741 matching lines...) Expand 10 before | Expand all | Expand 10 after
10914 return null; 10923 return null;
10915 } 10924 }
10916 if (identical(node.staticElement, variable)) { 10925 if (identical(node.staticElement, variable)) {
10917 if (node.inSetterContext()) { 10926 if (node.inSetterContext()) {
10918 result = true; 10927 result = true;
10919 } 10928 }
10920 } 10929 }
10921 return null; 10930 return null;
10922 } 10931 }
10923 } 10932 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/error/codes.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