| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.task.dart; | 5 library analyzer.src.task.dart; |
| 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/src/context/cache.dart'; | 10 import 'package:analyzer/src/context/cache.dart'; |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 // Shortcut for ClassElement(s) without implicit constructors. | 445 // Shortcut for ClassElement(s) without implicit constructors. |
| 446 // | 446 // |
| 447 if (superConstructors == null) { | 447 if (superConstructors == null) { |
| 448 outputs[CONSTRUCTORS] = classElement.constructors; | 448 outputs[CONSTRUCTORS] = classElement.constructors; |
| 449 outputs[CONSTRUCTORS_ERRORS] = AnalysisError.NO_ERRORS; | 449 outputs[CONSTRUCTORS_ERRORS] = AnalysisError.NO_ERRORS; |
| 450 return; | 450 return; |
| 451 } | 451 } |
| 452 // | 452 // |
| 453 // ClassTypeAlias | 453 // ClassTypeAlias |
| 454 // | 454 // |
| 455 if (classElement.isTypedef) { | 455 if (classElement.isMixinApplication) { |
| 456 List<ConstructorElement> implicitConstructors = | 456 List<ConstructorElement> implicitConstructors = |
| 457 new List<ConstructorElement>(); | 457 new List<ConstructorElement>(); |
| 458 void callback(ConstructorElement explicitConstructor, | 458 void callback(ConstructorElement explicitConstructor, |
| 459 List<DartType> parameterTypes, List<DartType> argumentTypes) { | 459 List<DartType> parameterTypes, List<DartType> argumentTypes) { |
| 460 implicitConstructors.add(_createImplicitContructor(classElement.type, | 460 implicitConstructors.add(_createImplicitContructor(classElement.type, |
| 461 explicitConstructor, parameterTypes, argumentTypes)); | 461 explicitConstructor, parameterTypes, argumentTypes)); |
| 462 } | 462 } |
| 463 if (_findForwardedConstructors(classElement, superType, callback)) { | 463 if (_findForwardedConstructors(classElement, superType, callback)) { |
| 464 if (implicitConstructors.isEmpty) { | 464 if (implicitConstructors.isEmpty) { |
| 465 errors.add(new AnalysisError(classElement.source, | 465 errors.add(new AnalysisError(classElement.source, |
| 466 classElement.nameOffset, classElement.name.length, | 466 classElement.nameOffset, classElement.name.length, |
| 467 CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS, | 467 CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS, |
| 468 [superType.element.name])); | 468 [superType.element.name])); |
| 469 } else { | 469 } else { |
| 470 classElement.constructors = implicitConstructors; | 470 classElement.constructors = implicitConstructors; |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 outputs[CONSTRUCTORS] = classElement.constructors; | 473 outputs[CONSTRUCTORS] = classElement.constructors; |
| 474 outputs[CONSTRUCTORS_ERRORS] = errors; | 474 outputs[CONSTRUCTORS_ERRORS] = errors; |
| 475 } | 475 } |
| 476 // | 476 // |
| 477 // ClassDeclaration | 477 // ClassDeclaration |
| 478 // | 478 // |
| 479 if (!classElement.isTypedef) { | 479 if (!classElement.isMixinApplication) { |
| 480 bool constructorFound = false; | 480 bool constructorFound = false; |
| 481 void callback(ConstructorElement explicitConstructor, | 481 void callback(ConstructorElement explicitConstructor, |
| 482 List<DartType> parameterTypes, List<DartType> argumentTypes) { | 482 List<DartType> parameterTypes, List<DartType> argumentTypes) { |
| 483 constructorFound = true; | 483 constructorFound = true; |
| 484 } | 484 } |
| 485 if (_findForwardedConstructors(classElement, superType, callback) && | 485 if (_findForwardedConstructors(classElement, superType, callback) && |
| 486 !constructorFound) { | 486 !constructorFound) { |
| 487 SourceRange withRange = classElement.withClauseRange; | 487 SourceRange withRange = classElement.withClauseRange; |
| 488 errors.add(new AnalysisError(classElement.source, withRange.offset, | 488 errors.add(new AnalysisError(classElement.source, withRange.offset, |
| 489 withRange.length, CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS, | 489 withRange.length, CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS, |
| 490 [superType.element.name])); | 490 [superType.element.name])); |
| 491 classElement.mixinErrorsReported = true; | 491 classElement.mixinErrorsReported = true; |
| 492 } | 492 } |
| 493 outputs[CONSTRUCTORS] = classElement.constructors; | 493 outputs[CONSTRUCTORS] = classElement.constructors; |
| 494 outputs[CONSTRUCTORS_ERRORS] = errors; | 494 outputs[CONSTRUCTORS_ERRORS] = errors; |
| 495 } | 495 } |
| 496 } | 496 } |
| 497 | 497 |
| 498 /** | 498 /** |
| 499 * Return a map from the names of the inputs of this kind of task to the task | 499 * Return a map from the names of the inputs of this kind of task to the task |
| 500 * input descriptors describing those inputs for a task with the | 500 * input descriptors describing those inputs for a task with the |
| 501 * given [classElement]. | 501 * given [classElement]. |
| 502 */ | 502 */ |
| 503 static Map<String, TaskInput> buildInputs(ClassElement classElement) { | 503 static Map<String, TaskInput> buildInputs(ClassElement classElement) { |
| 504 Source librarySource = classElement.library.source; | 504 Source librarySource = classElement.library.source; |
| 505 DartType superType = classElement.supertype; | 505 DartType superType = classElement.supertype; |
| 506 if (superType is InterfaceType) { | 506 if (superType is InterfaceType) { |
| 507 if (classElement.isTypedef || classElement.mixins.isNotEmpty) { | 507 if (classElement.isMixinApplication || classElement.mixins.isNotEmpty) { |
| 508 ClassElement superElement = superType.element; | 508 ClassElement superElement = superType.element; |
| 509 return <String, TaskInput>{ | 509 return <String, TaskInput>{ |
| 510 'libraryDep': LIBRARY_ELEMENT5.of(librarySource), | 510 'libraryDep': LIBRARY_ELEMENT5.of(librarySource), |
| 511 SUPER_CONSTRUCTORS: CONSTRUCTORS.of(superElement) | 511 SUPER_CONSTRUCTORS: CONSTRUCTORS.of(superElement) |
| 512 }; | 512 }; |
| 513 } | 513 } |
| 514 } | 514 } |
| 515 // No implicit constructors. | 515 // No implicit constructors. |
| 516 // Depend on LIBRARY_ELEMENT5 for invalidation. | 516 // Depend on LIBRARY_ELEMENT5 for invalidation. |
| 517 return <String, TaskInput>{ | 517 return <String, TaskInput>{ |
| (...skipping 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3362 @override | 3362 @override |
| 3363 bool moveNext() { | 3363 bool moveNext() { |
| 3364 if (_newSources.isEmpty) { | 3364 if (_newSources.isEmpty) { |
| 3365 return false; | 3365 return false; |
| 3366 } | 3366 } |
| 3367 currentTarget = _newSources.first; | 3367 currentTarget = _newSources.first; |
| 3368 _newSources.remove(currentTarget); | 3368 _newSources.remove(currentTarget); |
| 3369 return true; | 3369 return true; |
| 3370 } | 3370 } |
| 3371 } | 3371 } |
| OLD | NEW |