| 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 'ast.dart'; | 10 import 'ast.dart'; |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 _intType = _typeProvider.intType; | 264 _intType = _typeProvider.intType; |
| 265 _DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMENT = <InterfaceType>[ | 265 _DISALLOWED_TYPES_TO_EXTEND_OR_IMPLEMENT = <InterfaceType>[ |
| 266 _typeProvider.nullType, | 266 _typeProvider.nullType, |
| 267 _typeProvider.numType, | 267 _typeProvider.numType, |
| 268 _intType, | 268 _intType, |
| 269 _typeProvider.doubleType, | 269 _typeProvider.doubleType, |
| 270 _boolType, | 270 _boolType, |
| 271 _typeProvider.stringType]; | 271 _typeProvider.stringType]; |
| 272 } | 272 } |
| 273 | 273 |
| 274 /** |
| 275 * Initialize this instance with the given [ClassDeclaration]. |
| 276 */ |
| 277 void initClassDeclaration(ClassDeclaration node) { |
| 278 _isInNativeClass = node.nativeClause != null; |
| 279 _enclosingClass = node.element; |
| 280 // initialize initialFieldElementsMap |
| 281 if (_enclosingClass != null) { |
| 282 List<FieldElement> fieldElements = _enclosingClass.fields; |
| 283 _initialFieldElementsMap = new HashMap<FieldElement, INIT_STATE>(); |
| 284 for (FieldElement fieldElement in fieldElements) { |
| 285 if (!fieldElement.isSynthetic) { |
| 286 _initialFieldElementsMap[fieldElement] = |
| 287 fieldElement.initializer == null ? |
| 288 INIT_STATE.NOT_INIT : |
| 289 INIT_STATE.INIT_IN_DECLARATION; |
| 290 } |
| 291 } |
| 292 } |
| 293 } |
| 294 |
| 274 @override | 295 @override |
| 275 Object visitAnnotation(Annotation node) { | 296 Object visitAnnotation(Annotation node) { |
| 276 _checkForInvalidAnnotationFromDeferredLibrary(node); | 297 _checkForInvalidAnnotationFromDeferredLibrary(node); |
| 277 return super.visitAnnotation(node); | 298 return super.visitAnnotation(node); |
| 278 } | 299 } |
| 279 | 300 |
| 280 @override | 301 @override |
| 281 Object visitArgumentList(ArgumentList node) { | 302 Object visitArgumentList(ArgumentList node) { |
| 282 _checkForArgumentTypesNotAssignableInList(node); | 303 _checkForArgumentTypesNotAssignableInList(node); |
| 283 return super.visitArgumentList(node); | 304 return super.visitArgumentList(node); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 _checkForImplementsDeferredClass(implementsClause); | 444 _checkForImplementsDeferredClass(implementsClause); |
| 424 _checkForNonAbstractClassInheritsAbstractMember(node.name); | 445 _checkForNonAbstractClassInheritsAbstractMember(node.name); |
| 425 _checkForInconsistentMethodInheritance(); | 446 _checkForInconsistentMethodInheritance(); |
| 426 _checkForRecursiveInterfaceInheritance(_enclosingClass); | 447 _checkForRecursiveInterfaceInheritance(_enclosingClass); |
| 427 _checkForConflictingGetterAndMethod(); | 448 _checkForConflictingGetterAndMethod(); |
| 428 _checkForConflictingInstanceGetterAndSuperclassMember(); | 449 _checkForConflictingInstanceGetterAndSuperclassMember(); |
| 429 _checkImplementsSuperClass(node); | 450 _checkImplementsSuperClass(node); |
| 430 _checkImplementsFunctionWithoutCall(node); | 451 _checkImplementsFunctionWithoutCall(node); |
| 431 } | 452 } |
| 432 } | 453 } |
| 433 // initialize initialFieldElementsMap | 454 initClassDeclaration(node); |
| 434 if (_enclosingClass != null) { | |
| 435 List<FieldElement> fieldElements = _enclosingClass.fields; | |
| 436 _initialFieldElementsMap = new HashMap<FieldElement, INIT_STATE>(); | |
| 437 for (FieldElement fieldElement in fieldElements) { | |
| 438 if (!fieldElement.isSynthetic) { | |
| 439 _initialFieldElementsMap[fieldElement] = | |
| 440 fieldElement.initializer == null ? | |
| 441 INIT_STATE.NOT_INIT : | |
| 442 INIT_STATE.INIT_IN_DECLARATION; | |
| 443 } | |
| 444 } | |
| 445 } | |
| 446 _checkForFinalNotInitializedInClass(node); | 455 _checkForFinalNotInitializedInClass(node); |
| 447 _checkForDuplicateDefinitionInheritance(); | 456 _checkForDuplicateDefinitionInheritance(); |
| 448 _checkForConflictingInstanceMethodSetter(node); | 457 _checkForConflictingInstanceMethodSetter(node); |
| 449 return super.visitClassDeclaration(node); | 458 return super.visitClassDeclaration(node); |
| 450 } finally { | 459 } finally { |
| 451 _isInNativeClass = false; | 460 _isInNativeClass = false; |
| 452 _initialFieldElementsMap = null; | 461 _initialFieldElementsMap = null; |
| 453 _enclosingClass = outerClass; | 462 _enclosingClass = outerClass; |
| 454 } | 463 } |
| 455 } | 464 } |
| (...skipping 5759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6215 toCheck.add(type.element); | 6224 toCheck.add(type.element); |
| 6216 // type arguments | 6225 // type arguments |
| 6217 if (type is InterfaceType) { | 6226 if (type is InterfaceType) { |
| 6218 InterfaceType interfaceType = type; | 6227 InterfaceType interfaceType = type; |
| 6219 for (DartType typeArgument in interfaceType.typeArguments) { | 6228 for (DartType typeArgument in interfaceType.typeArguments) { |
| 6220 _addTypeToCheck(typeArgument); | 6229 _addTypeToCheck(typeArgument); |
| 6221 } | 6230 } |
| 6222 } | 6231 } |
| 6223 } | 6232 } |
| 6224 } | 6233 } |
| OLD | NEW |