| OLD | NEW |
| 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 engine.resolver.error_verifier; | 5 library engine.resolver.error_verifier; |
| 6 | 6 |
| 7 import "dart:math" as math; | 7 import "dart:math" as math; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/static_type_analyzer.dart'; | 10 import 'package:analyzer/src/generated/static_type_analyzer.dart'; |
| (...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 if (element == null) { | 1583 if (element == null) { |
| 1584 continue; | 1584 continue; |
| 1585 } | 1585 } |
| 1586 PropertyAccessorElement getter = element.getter; | 1586 PropertyAccessorElement getter = element.getter; |
| 1587 PropertyAccessorElement setter = element.setter; | 1587 PropertyAccessorElement setter = element.setter; |
| 1588 SimpleIdentifier fieldName = field.name; | 1588 SimpleIdentifier fieldName = field.name; |
| 1589 if (getter != null) { | 1589 if (getter != null) { |
| 1590 if (_checkForAllInvalidOverrideErrorCodesForExecutable( | 1590 if (_checkForAllInvalidOverrideErrorCodesForExecutable( |
| 1591 getter, | 1591 getter, |
| 1592 ParameterElementImpl.EMPTY_ARRAY, | 1592 ParameterElementImpl.EMPTY_ARRAY, |
| 1593 AstNode.EMPTY_ARRAY, | 1593 AstNode.EMPTY_LIST, |
| 1594 fieldName)) { | 1594 fieldName)) { |
| 1595 hasProblems = true; | 1595 hasProblems = true; |
| 1596 } | 1596 } |
| 1597 } | 1597 } |
| 1598 if (setter != null) { | 1598 if (setter != null) { |
| 1599 if (_checkForAllInvalidOverrideErrorCodesForExecutable( | 1599 if (_checkForAllInvalidOverrideErrorCodesForExecutable( |
| 1600 setter, | 1600 setter, |
| 1601 setter.parameters, | 1601 setter.parameters, |
| 1602 <AstNode>[fieldName], | 1602 <AstNode>[fieldName], |
| 1603 fieldName)) { | 1603 fieldName)) { |
| (...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4347 bool _checkForMixedReturns(BlockFunctionBody node) { | 4347 bool _checkForMixedReturns(BlockFunctionBody node) { |
| 4348 if (_hasReturnWithoutValue) { | 4348 if (_hasReturnWithoutValue) { |
| 4349 return false; | 4349 return false; |
| 4350 } | 4350 } |
| 4351 int withCount = _returnsWith.length; | 4351 int withCount = _returnsWith.length; |
| 4352 int withoutCount = _returnsWithout.length; | 4352 int withoutCount = _returnsWithout.length; |
| 4353 if (withCount > 0 && withoutCount > 0) { | 4353 if (withCount > 0 && withoutCount > 0) { |
| 4354 for (int i = 0; i < withCount; i++) { | 4354 for (int i = 0; i < withCount; i++) { |
| 4355 _errorReporter.reportErrorForToken( | 4355 _errorReporter.reportErrorForToken( |
| 4356 StaticWarningCode.MIXED_RETURN_TYPES, | 4356 StaticWarningCode.MIXED_RETURN_TYPES, |
| 4357 _returnsWith[i].keyword); | 4357 _returnsWith[i].returnKeyword); |
| 4358 } | 4358 } |
| 4359 for (int i = 0; i < withoutCount; i++) { | 4359 for (int i = 0; i < withoutCount; i++) { |
| 4360 _errorReporter.reportErrorForToken( | 4360 _errorReporter.reportErrorForToken( |
| 4361 StaticWarningCode.MIXED_RETURN_TYPES, | 4361 StaticWarningCode.MIXED_RETURN_TYPES, |
| 4362 _returnsWithout[i].keyword); | 4362 _returnsWithout[i].returnKeyword); |
| 4363 } | 4363 } |
| 4364 return true; | 4364 return true; |
| 4365 } | 4365 } |
| 4366 return false; | 4366 return false; |
| 4367 } | 4367 } |
| 4368 | 4368 |
| 4369 /** | 4369 /** |
| 4370 * This verifies that the passed mixin does not have an explicitly declared co
nstructor. | 4370 * This verifies that the passed mixin does not have an explicitly declared co
nstructor. |
| 4371 * | 4371 * |
| 4372 * @param mixinName the node to report problem on | 4372 * @param mixinName the node to report problem on |
| (...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5969 * | 5969 * |
| 5970 * @param directives the list of directives that have the same prefix | 5970 * @param directives the list of directives that have the same prefix |
| 5971 * @return `true` if an error was generated | 5971 * @return `true` if an error was generated |
| 5972 * See [CompileTimeErrorCode.SHARED_DEFERRED_PREFIX]. | 5972 * See [CompileTimeErrorCode.SHARED_DEFERRED_PREFIX]. |
| 5973 */ | 5973 */ |
| 5974 bool _hasDeferredPrefixCollision(List<ImportDirective> directives) { | 5974 bool _hasDeferredPrefixCollision(List<ImportDirective> directives) { |
| 5975 bool foundError = false; | 5975 bool foundError = false; |
| 5976 int count = directives.length; | 5976 int count = directives.length; |
| 5977 if (count > 1) { | 5977 if (count > 1) { |
| 5978 for (int i = 0; i < count; i++) { | 5978 for (int i = 0; i < count; i++) { |
| 5979 sc.Token deferredToken = directives[i].deferredToken; | 5979 sc.Token deferredToken = directives[i].deferredKeyword; |
| 5980 if (deferredToken != null) { | 5980 if (deferredToken != null) { |
| 5981 _errorReporter.reportErrorForToken( | 5981 _errorReporter.reportErrorForToken( |
| 5982 CompileTimeErrorCode.SHARED_DEFERRED_PREFIX, | 5982 CompileTimeErrorCode.SHARED_DEFERRED_PREFIX, |
| 5983 deferredToken); | 5983 deferredToken); |
| 5984 foundError = true; | 5984 foundError = true; |
| 5985 } | 5985 } |
| 5986 } | 5986 } |
| 5987 } | 5987 } |
| 5988 return foundError; | 5988 return foundError; |
| 5989 } | 5989 } |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6324 toCheck.add(type.element); | 6324 toCheck.add(type.element); |
| 6325 // type arguments | 6325 // type arguments |
| 6326 if (type is InterfaceType) { | 6326 if (type is InterfaceType) { |
| 6327 InterfaceType interfaceType = type; | 6327 InterfaceType interfaceType = type; |
| 6328 for (DartType typeArgument in interfaceType.typeArguments) { | 6328 for (DartType typeArgument in interfaceType.typeArguments) { |
| 6329 _addTypeToCheck(typeArgument); | 6329 _addTypeToCheck(typeArgument); |
| 6330 } | 6330 } |
| 6331 } | 6331 } |
| 6332 } | 6332 } |
| 6333 } | 6333 } |
| OLD | NEW |