Chromium Code Reviews| 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 | 8 |
| 9 import 'package:analyzer/src/context/cache.dart'; | 9 import 'package:analyzer/src/context/cache.dart'; |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| 11 import 'package:analyzer/src/generated/constant.dart'; | 11 import 'package:analyzer/src/generated/constant.dart'; |
| 12 import 'package:analyzer/src/generated/element.dart'; | 12 import 'package:analyzer/src/generated/element.dart'; |
| 13 import 'package:analyzer/src/generated/engine.dart' | 13 import 'package:analyzer/src/generated/engine.dart' |
| 14 hide AnalysisCache, AnalysisTask; | 14 hide AnalysisCache, AnalysisTask; |
| 15 import 'package:analyzer/src/generated/error.dart'; | 15 import 'package:analyzer/src/generated/error.dart'; |
| 16 import 'package:analyzer/src/generated/error_verifier.dart'; | 16 import 'package:analyzer/src/generated/error_verifier.dart'; |
| 17 import 'package:analyzer/src/generated/java_engine.dart'; | 17 import 'package:analyzer/src/generated/java_engine.dart'; |
| 18 import 'package:analyzer/src/generated/parser.dart'; | 18 import 'package:analyzer/src/generated/parser.dart'; |
| 19 import 'package:analyzer/src/generated/resolver.dart'; | 19 import 'package:analyzer/src/generated/resolver.dart'; |
| 20 import 'package:analyzer/src/generated/scanner.dart'; | 20 import 'package:analyzer/src/generated/scanner.dart'; |
| 21 import 'package:analyzer/src/generated/sdk.dart'; | 21 import 'package:analyzer/src/generated/sdk.dart'; |
| 22 import 'package:analyzer/src/generated/source.dart'; | 22 import 'package:analyzer/src/generated/source.dart'; |
| 23 import 'package:analyzer/src/task/driver.dart'; | 23 import 'package:analyzer/src/task/driver.dart'; |
| 24 import 'package:analyzer/src/task/general.dart'; | 24 import 'package:analyzer/src/task/general.dart'; |
| 25 import 'package:analyzer/src/task/html.dart'; | 25 import 'package:analyzer/src/task/html.dart'; |
| 26 import 'package:analyzer/src/task/inputs.dart'; | 26 import 'package:analyzer/src/task/inputs.dart'; |
| 27 import 'package:analyzer/src/task/model.dart'; | 27 import 'package:analyzer/src/task/model.dart'; |
| 28 import 'package:analyzer/src/task/strong_mode.dart'; | |
| 28 import 'package:analyzer/task/dart.dart'; | 29 import 'package:analyzer/task/dart.dart'; |
| 29 import 'package:analyzer/task/general.dart'; | 30 import 'package:analyzer/task/general.dart'; |
| 30 import 'package:analyzer/task/model.dart'; | 31 import 'package:analyzer/task/model.dart'; |
| 31 | 32 |
| 32 /** | 33 /** |
| 33 * The [ResultCachingPolicy] for ASTs. | 34 * The [ResultCachingPolicy] for ASTs. |
| 34 */ | 35 */ |
| 35 const ResultCachingPolicy AST_CACHING_POLICY = | 36 const ResultCachingPolicy AST_CACHING_POLICY = |
| 36 const SimpleResultCachingPolicy(8192, 8192); | 37 const SimpleResultCachingPolicy(8192, 8192); |
| 37 | 38 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 51 * | 52 * |
| 52 * The list will be empty if there were no errors, but will not be `null`. | 53 * The list will be empty if there were no errors, but will not be `null`. |
| 53 * | 54 * |
| 54 * The result is only available for [Source]s representing a library. | 55 * The result is only available for [Source]s representing a library. |
| 55 */ | 56 */ |
| 56 final ListResultDescriptor<AnalysisError> BUILD_LIBRARY_ERRORS = | 57 final ListResultDescriptor<AnalysisError> BUILD_LIBRARY_ERRORS = |
| 57 new ListResultDescriptor<AnalysisError>( | 58 new ListResultDescriptor<AnalysisError>( |
| 58 'BUILD_LIBRARY_ERRORS', AnalysisError.NO_ERRORS); | 59 'BUILD_LIBRARY_ERRORS', AnalysisError.NO_ERRORS); |
| 59 | 60 |
| 60 /** | 61 /** |
| 62 * A list of the [ClassElement]s representing the classes defined in a | |
| 63 * compilation unit. | |
| 64 * | |
| 65 * The result is only available for [LibrarySpecificUnit]s, and only when strong | |
| 66 * mode is enabled. | |
| 67 */ | |
| 68 final ListResultDescriptor<ClassElement> CLASSES_IN_UNIT = | |
| 69 new ListResultDescriptor<ClassElement>('CLASSES_IN_UNIT', null); | |
| 70 | |
| 71 /** | |
| 61 * A list of the [ConstantEvaluationTarget]s defined in a unit. This includes | 72 * A list of the [ConstantEvaluationTarget]s defined in a unit. This includes |
| 62 * constants defined at top level, statically inside classes, and local to | 73 * constants defined at top level, statically inside classes, and local to |
| 63 * functions, as well as constant constructors, annotations, and default values | 74 * functions, as well as constant constructors, annotations, and default values |
| 64 * of parameters to constant constructors. | 75 * of parameters to constant constructors. |
| 65 */ | 76 */ |
| 66 final ListResultDescriptor<ConstantEvaluationTarget> COMPILATION_UNIT_CONSTANTS = | 77 final ListResultDescriptor< |
| 78 ConstantEvaluationTarget> COMPILATION_UNIT_CONSTANTS = | |
|
scheglov
2015/08/17 20:08:49
OMG, why does it format it this way?...
Also, it
Brian Wilkerson
2015/08/18 00:07:04
That would be a question for Bob.
| |
| 67 new ListResultDescriptor<ConstantEvaluationTarget>( | 79 new ListResultDescriptor<ConstantEvaluationTarget>( |
| 68 'COMPILATION_UNIT_CONSTANTS', null, | 80 'COMPILATION_UNIT_CONSTANTS', null, |
| 69 cachingPolicy: ELEMENT_CACHING_POLICY); | 81 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 70 | 82 |
| 71 /** | 83 /** |
| 72 * The element model associated with a single compilation unit. | 84 * The element model associated with a single compilation unit. |
| 73 * | 85 * |
| 74 * The result is only available for [LibrarySpecificUnit]s. | 86 * The result is only available for [LibrarySpecificUnit]s. |
| 75 */ | 87 */ |
| 76 final ResultDescriptor<CompilationUnitElement> COMPILATION_UNIT_ELEMENT = | 88 final ResultDescriptor<CompilationUnitElement> COMPILATION_UNIT_ELEMENT = |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 /** | 148 /** |
| 137 * The sources representing the combined import/export closure of a library. | 149 * The sources representing the combined import/export closure of a library. |
| 138 * The [Source]s include only library sources, not their units. | 150 * The [Source]s include only library sources, not their units. |
| 139 * | 151 * |
| 140 * The result is only available for [Source]s representing a library. | 152 * The result is only available for [Source]s representing a library. |
| 141 */ | 153 */ |
| 142 final ListResultDescriptor<Source> IMPORT_EXPORT_SOURCE_CLOSURE = | 154 final ListResultDescriptor<Source> IMPORT_EXPORT_SOURCE_CLOSURE = |
| 143 new ListResultDescriptor<Source>('IMPORT_EXPORT_SOURCE_CLOSURE', null); | 155 new ListResultDescriptor<Source>('IMPORT_EXPORT_SOURCE_CLOSURE', null); |
| 144 | 156 |
| 145 /** | 157 /** |
| 158 * A list of the [VariableElement]s defined in a unit whose type should be | |
| 159 * inferred. This includes variables defined at the library level as well as | |
| 160 * static members inside classes. | |
| 161 * | |
| 162 * The result is only available for [LibrarySpecificUnit]s, and only when strong | |
| 163 * mode is enabled. | |
| 164 */ | |
| 165 final ListResultDescriptor<VariableElement> INFERABLE_STATIC_VARIABLES_IN_UNIT = | |
| 166 new ListResultDescriptor<VariableElement>( | |
| 167 'INFERABLE_STATIC_VARIABLES_IN_UNIT', null); | |
| 168 | |
| 169 /** | |
| 146 * The partial [LibraryElement] associated with a library. | 170 * The partial [LibraryElement] associated with a library. |
| 147 * | 171 * |
| 148 * The [LibraryElement] and its [CompilationUnitElement]s are attached to each | 172 * The [LibraryElement] and its [CompilationUnitElement]s are attached to each |
| 149 * other. Directives 'library', 'part' and 'part of' are resolved. | 173 * other. Directives 'library', 'part' and 'part of' are resolved. |
| 150 * | 174 * |
| 151 * The result is only available for [Source]s representing a library. | 175 * The result is only available for [Source]s representing a library. |
| 152 */ | 176 */ |
| 153 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT1 = | 177 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT1 = |
| 154 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT1', null, | 178 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT1', null, |
| 155 cachingPolicy: ELEMENT_CACHING_POLICY); | 179 cachingPolicy: ELEMENT_CACHING_POLICY); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 class BuildCompilationUnitElementTask extends SourceBasedAnalysisTask { | 416 class BuildCompilationUnitElementTask extends SourceBasedAnalysisTask { |
| 393 /** | 417 /** |
| 394 * The name of the input whose value is the AST for the compilation unit. | 418 * The name of the input whose value is the AST for the compilation unit. |
| 395 */ | 419 */ |
| 396 static const String PARSED_UNIT_INPUT_NAME = 'PARSED_UNIT_INPUT_NAME'; | 420 static const String PARSED_UNIT_INPUT_NAME = 'PARSED_UNIT_INPUT_NAME'; |
| 397 | 421 |
| 398 /** | 422 /** |
| 399 * The task descriptor describing this kind of task. | 423 * The task descriptor describing this kind of task. |
| 400 */ | 424 */ |
| 401 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 425 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 402 'BuildCompilationUnitElementTask', createTask, buildInputs, | 426 'BuildCompilationUnitElementTask', |
| 403 <ResultDescriptor>[ | 427 createTask, |
| 428 buildInputs, <ResultDescriptor>[ | |
| 429 CLASSES_IN_UNIT, | |
| 430 COMPILATION_UNIT_CONSTANTS, | |
| 404 COMPILATION_UNIT_ELEMENT, | 431 COMPILATION_UNIT_ELEMENT, |
| 405 RESOLVED_UNIT1, | 432 INFERABLE_STATIC_VARIABLES_IN_UNIT, |
| 406 COMPILATION_UNIT_CONSTANTS | 433 RESOLVED_UNIT1 |
| 407 ]); | 434 ]); |
| 408 | 435 |
| 409 /** | 436 /** |
| 410 * Initialize a newly created task to build a compilation unit element for | 437 * Initialize a newly created task to build a compilation unit element for |
| 411 * the given [target] in the given [context]. | 438 * the given [target] in the given [context]. |
| 412 */ | 439 */ |
| 413 BuildCompilationUnitElementTask( | 440 BuildCompilationUnitElementTask( |
| 414 InternalAnalysisContext context, AnalysisTarget target) | 441 InternalAnalysisContext context, AnalysisTarget target) |
| 415 : super(context, target); | 442 : super(context, target); |
| 416 | 443 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 439 source, unit, librarySpecificUnit.library); | 466 source, unit, librarySpecificUnit.library); |
| 440 } else { | 467 } else { |
| 441 new DeclarationResolver().resolve(unit, element); | 468 new DeclarationResolver().resolve(unit, element); |
| 442 } | 469 } |
| 443 // | 470 // |
| 444 // Prepare constants. | 471 // Prepare constants. |
| 445 // | 472 // |
| 446 ConstantFinder constantFinder = | 473 ConstantFinder constantFinder = |
| 447 new ConstantFinder(context, source, librarySpecificUnit.library); | 474 new ConstantFinder(context, source, librarySpecificUnit.library); |
| 448 unit.accept(constantFinder); | 475 unit.accept(constantFinder); |
| 449 List<ConstantEvaluationTarget> constants = | 476 List<ConstantEvaluationTarget> constants = new List< |
| 450 new List<ConstantEvaluationTarget>.from( | 477 ConstantEvaluationTarget>.from(constantFinder.constantsToCompute); |
| 451 constantFinder.constantsToCompute); | 478 // |
| 479 // Prepare targets for inference. | |
| 480 // | |
| 481 List<VariableElement> staticVariables = <VariableElement>[]; | |
| 482 List<ClassElement> classes = <ClassElement>[]; | |
| 483 if (context.analysisOptions.strongMode) { | |
| 484 InferrenceFinder inferrenceFinder = new InferrenceFinder(); | |
| 485 unit.accept(inferrenceFinder); | |
| 486 staticVariables = inferrenceFinder.staticVariables; | |
| 487 classes = inferrenceFinder.classes; | |
| 488 } | |
| 452 // | 489 // |
| 453 // Record outputs. | 490 // Record outputs. |
| 454 // | 491 // |
| 492 outputs[CLASSES_IN_UNIT] = classes; | |
| 493 outputs[COMPILATION_UNIT_CONSTANTS] = constants; | |
| 455 outputs[COMPILATION_UNIT_ELEMENT] = element; | 494 outputs[COMPILATION_UNIT_ELEMENT] = element; |
| 495 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = staticVariables; | |
| 456 outputs[RESOLVED_UNIT1] = unit; | 496 outputs[RESOLVED_UNIT1] = unit; |
| 457 outputs[COMPILATION_UNIT_CONSTANTS] = constants; | |
| 458 } | 497 } |
| 459 | 498 |
| 460 /** | 499 /** |
| 461 * Return a map from the names of the inputs of this kind of task to the task | 500 * Return a map from the names of the inputs of this kind of task to the task |
| 462 * input descriptors describing those inputs for a task with the given | 501 * input descriptors describing those inputs for a task with the given |
| 463 * [target]. | 502 * [target]. |
| 464 */ | 503 */ |
| 465 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 504 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 466 LibrarySpecificUnit unit = target; | 505 LibrarySpecificUnit unit = target; |
| 467 return <String, TaskInput>{ | 506 return <String, TaskInput>{ |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 514 /** | 553 /** |
| 515 * The input with a list of [SOURCE_KIND]s of exported libraries. | 554 * The input with a list of [SOURCE_KIND]s of exported libraries. |
| 516 */ | 555 */ |
| 517 static const String EXPORTS_SOURCE_KIND_INPUT_NAME = | 556 static const String EXPORTS_SOURCE_KIND_INPUT_NAME = |
| 518 'EXPORTS_SOURCE_KIND_INPUT_NAME'; | 557 'EXPORTS_SOURCE_KIND_INPUT_NAME'; |
| 519 | 558 |
| 520 /** | 559 /** |
| 521 * The task descriptor describing this kind of task. | 560 * The task descriptor describing this kind of task. |
| 522 */ | 561 */ |
| 523 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 562 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 524 'BuildDirectiveElementsTask', createTask, buildInputs, <ResultDescriptor>[ | 563 'BuildDirectiveElementsTask', |
| 525 LIBRARY_ELEMENT2, | 564 createTask, |
| 526 BUILD_DIRECTIVES_ERRORS | 565 buildInputs, |
| 527 ]); | 566 <ResultDescriptor>[LIBRARY_ELEMENT2, BUILD_DIRECTIVES_ERRORS]); |
| 528 | 567 |
| 529 BuildDirectiveElementsTask( | 568 BuildDirectiveElementsTask( |
| 530 InternalAnalysisContext context, AnalysisTarget target) | 569 InternalAnalysisContext context, AnalysisTarget target) |
| 531 : super(context, target); | 570 : super(context, target); |
| 532 | 571 |
| 533 @override | 572 @override |
| 534 TaskDescriptor get descriptor => DESCRIPTOR; | 573 TaskDescriptor get descriptor => DESCRIPTOR; |
| 535 | 574 |
| 536 @override | 575 @override |
| 537 void internalPerform() { | 576 void internalPerform() { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 622 if (uriLiteral != null) { | 661 if (uriLiteral != null) { |
| 623 exportElement.uriOffset = uriLiteral.offset; | 662 exportElement.uriOffset = uriLiteral.offset; |
| 624 exportElement.uriEnd = uriLiteral.end; | 663 exportElement.uriEnd = uriLiteral.end; |
| 625 } | 664 } |
| 626 exportElement.uri = exportDirective.uriContent; | 665 exportElement.uri = exportDirective.uriContent; |
| 627 exportElement.combinators = _buildCombinators(exportDirective); | 666 exportElement.combinators = _buildCombinators(exportDirective); |
| 628 exportElement.exportedLibrary = exportedLibrary; | 667 exportElement.exportedLibrary = exportedLibrary; |
| 629 directive.element = exportElement; | 668 directive.element = exportElement; |
| 630 exports.add(exportElement); | 669 exports.add(exportElement); |
| 631 if (exportSourceKindMap[exportedSource] != SourceKind.LIBRARY) { | 670 if (exportSourceKindMap[exportedSource] != SourceKind.LIBRARY) { |
| 632 errors.add(new AnalysisError(exportedSource, uriLiteral.offset, | 671 errors.add(new AnalysisError( |
| 633 uriLiteral.length, CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY, | 672 exportedSource, |
| 673 uriLiteral.offset, | |
| 674 uriLiteral.length, | |
| 675 CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY, | |
| 634 [uriLiteral.toSource()])); | 676 [uriLiteral.toSource()])); |
| 635 } | 677 } |
| 636 } | 678 } |
| 637 } | 679 } |
| 638 } | 680 } |
| 639 } | 681 } |
| 640 // | 682 // |
| 641 // Ensure "dart:core" import. | 683 // Ensure "dart:core" import. |
| 642 // | 684 // |
| 643 Source coreLibrarySource = context.sourceFactory.forUri(DartSdk.DART_CORE); | 685 Source coreLibrarySource = context.sourceFactory.forUri(DartSdk.DART_CORE); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 733 | 775 |
| 734 /** | 776 /** |
| 735 * The name of the [RESOLVED_UNIT1] input. | 777 * The name of the [RESOLVED_UNIT1] input. |
| 736 */ | 778 */ |
| 737 static const String UNIT_INPUT = 'UNIT_INPUT'; | 779 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 738 | 780 |
| 739 /** | 781 /** |
| 740 * The task descriptor describing this kind of task. | 782 * The task descriptor describing this kind of task. |
| 741 */ | 783 */ |
| 742 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 784 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 743 'BuildEnumMemberElementsTask', createTask, buildInputs, | 785 'BuildEnumMemberElementsTask', |
| 786 createTask, | |
| 787 buildInputs, | |
| 744 <ResultDescriptor>[RESOLVED_UNIT2]); | 788 <ResultDescriptor>[RESOLVED_UNIT2]); |
| 745 | 789 |
| 746 BuildEnumMemberElementsTask( | 790 BuildEnumMemberElementsTask( |
| 747 InternalAnalysisContext context, AnalysisTarget target) | 791 InternalAnalysisContext context, AnalysisTarget target) |
| 748 : super(context, target); | 792 : super(context, target); |
| 749 | 793 |
| 750 @override | 794 @override |
| 751 TaskDescriptor get descriptor => DESCRIPTOR; | 795 TaskDescriptor get descriptor => DESCRIPTOR; |
| 752 | 796 |
| 753 @override | 797 @override |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 794 class BuildExportNamespaceTask extends SourceBasedAnalysisTask { | 838 class BuildExportNamespaceTask extends SourceBasedAnalysisTask { |
| 795 /** | 839 /** |
| 796 * The name of the input for [LIBRARY_ELEMENT3] of a library. | 840 * The name of the input for [LIBRARY_ELEMENT3] of a library. |
| 797 */ | 841 */ |
| 798 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 842 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 799 | 843 |
| 800 /** | 844 /** |
| 801 * The task descriptor describing this kind of task. | 845 * The task descriptor describing this kind of task. |
| 802 */ | 846 */ |
| 803 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 847 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 804 'BuildExportNamespaceTask', createTask, buildInputs, | 848 'BuildExportNamespaceTask', |
| 849 createTask, | |
| 850 buildInputs, | |
| 805 <ResultDescriptor>[LIBRARY_ELEMENT4]); | 851 <ResultDescriptor>[LIBRARY_ELEMENT4]); |
| 806 | 852 |
| 807 BuildExportNamespaceTask( | 853 BuildExportNamespaceTask( |
| 808 InternalAnalysisContext context, AnalysisTarget target) | 854 InternalAnalysisContext context, AnalysisTarget target) |
| 809 : super(context, target); | 855 : super(context, target); |
| 810 | 856 |
| 811 @override | 857 @override |
| 812 TaskDescriptor get descriptor => DESCRIPTOR; | 858 TaskDescriptor get descriptor => DESCRIPTOR; |
| 813 | 859 |
| 814 @override | 860 @override |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 950 partElement.uriEnd = partUri.end; | 996 partElement.uriEnd = partUri.end; |
| 951 partElement.uri = partDirective.uriContent; | 997 partElement.uri = partDirective.uriContent; |
| 952 // | 998 // |
| 953 // Validate that the part contains a part-of directive with the same | 999 // Validate that the part contains a part-of directive with the same |
| 954 // name as the library. | 1000 // name as the library. |
| 955 // | 1001 // |
| 956 if (context.exists(partSource)) { | 1002 if (context.exists(partSource)) { |
| 957 String partLibraryName = | 1003 String partLibraryName = |
| 958 _getPartLibraryName(partSource, partUnit, directivesToResolve); | 1004 _getPartLibraryName(partSource, partUnit, directivesToResolve); |
| 959 if (partLibraryName == null) { | 1005 if (partLibraryName == null) { |
| 960 errors.add(new AnalysisError(librarySource, partUri.offset, | 1006 errors.add(new AnalysisError( |
| 961 partUri.length, CompileTimeErrorCode.PART_OF_NON_PART, | 1007 librarySource, |
| 1008 partUri.offset, | |
| 1009 partUri.length, | |
| 1010 CompileTimeErrorCode.PART_OF_NON_PART, | |
| 962 [partUri.toSource()])); | 1011 [partUri.toSource()])); |
| 963 } else if (libraryNameNode == null) { | 1012 } else if (libraryNameNode == null) { |
| 964 if (partsLibraryName == _UNKNOWN_LIBRARY_NAME) { | 1013 if (partsLibraryName == _UNKNOWN_LIBRARY_NAME) { |
| 965 partsLibraryName = partLibraryName; | 1014 partsLibraryName = partLibraryName; |
| 966 } else if (partsLibraryName != partLibraryName) { | 1015 } else if (partsLibraryName != partLibraryName) { |
| 967 partsLibraryName = null; | 1016 partsLibraryName = null; |
| 968 } | 1017 } |
| 969 } else if (libraryNameNode.name != partLibraryName) { | 1018 } else if (libraryNameNode.name != partLibraryName) { |
| 970 errors.add(new AnalysisError(librarySource, partUri.offset, | 1019 errors.add(new AnalysisError( |
| 971 partUri.length, StaticWarningCode.PART_OF_DIFFERENT_LIBRARY, [ | 1020 librarySource, |
| 972 libraryNameNode.name, | 1021 partUri.offset, |
| 973 partLibraryName | 1022 partUri.length, |
| 974 ])); | 1023 StaticWarningCode.PART_OF_DIFFERENT_LIBRARY, |
| 1024 [libraryNameNode.name, partLibraryName])); | |
| 975 } | 1025 } |
| 976 } | 1026 } |
| 977 if (entryPoint == null) { | 1027 if (entryPoint == null) { |
| 978 entryPoint = _findEntryPoint(partElement); | 1028 entryPoint = _findEntryPoint(partElement); |
| 979 } | 1029 } |
| 980 directive.element = partElement; | 1030 directive.element = partElement; |
| 981 sourcedCompilationUnits.add(partElement); | 1031 sourcedCompilationUnits.add(partElement); |
| 982 } | 1032 } |
| 983 } | 1033 } |
| 984 } | 1034 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1131 class BuildPublicNamespaceTask extends SourceBasedAnalysisTask { | 1181 class BuildPublicNamespaceTask extends SourceBasedAnalysisTask { |
| 1132 /** | 1182 /** |
| 1133 * The name of the input for [LIBRARY_ELEMENT2] of a library. | 1183 * The name of the input for [LIBRARY_ELEMENT2] of a library. |
| 1134 */ | 1184 */ |
| 1135 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 1185 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 1136 | 1186 |
| 1137 /** | 1187 /** |
| 1138 * The task descriptor describing this kind of task. | 1188 * The task descriptor describing this kind of task. |
| 1139 */ | 1189 */ |
| 1140 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1190 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1141 'BuildPublicNamespaceTask', createTask, buildInputs, | 1191 'BuildPublicNamespaceTask', |
| 1192 createTask, | |
| 1193 buildInputs, | |
| 1142 <ResultDescriptor>[LIBRARY_ELEMENT3]); | 1194 <ResultDescriptor>[LIBRARY_ELEMENT3]); |
| 1143 | 1195 |
| 1144 BuildPublicNamespaceTask( | 1196 BuildPublicNamespaceTask( |
| 1145 InternalAnalysisContext context, AnalysisTarget target) | 1197 InternalAnalysisContext context, AnalysisTarget target) |
| 1146 : super(context, target); | 1198 : super(context, target); |
| 1147 | 1199 |
| 1148 @override | 1200 @override |
| 1149 TaskDescriptor get descriptor => DESCRIPTOR; | 1201 TaskDescriptor get descriptor => DESCRIPTOR; |
| 1150 | 1202 |
| 1151 @override | 1203 @override |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1181 class BuildSourceExportClosureTask extends SourceBasedAnalysisTask { | 1233 class BuildSourceExportClosureTask extends SourceBasedAnalysisTask { |
| 1182 /** | 1234 /** |
| 1183 * The name of the export closure. | 1235 * The name of the export closure. |
| 1184 */ | 1236 */ |
| 1185 static const String EXPORT_INPUT = 'EXPORT_INPUT'; | 1237 static const String EXPORT_INPUT = 'EXPORT_INPUT'; |
| 1186 | 1238 |
| 1187 /** | 1239 /** |
| 1188 * The task descriptor describing this kind of task. | 1240 * The task descriptor describing this kind of task. |
| 1189 */ | 1241 */ |
| 1190 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1242 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1191 'BuildSourceExportClosureTask', createTask, buildInputs, | 1243 'BuildSourceExportClosureTask', |
| 1244 createTask, | |
| 1245 buildInputs, | |
| 1192 <ResultDescriptor>[EXPORT_SOURCE_CLOSURE]); | 1246 <ResultDescriptor>[EXPORT_SOURCE_CLOSURE]); |
| 1193 | 1247 |
| 1194 BuildSourceExportClosureTask( | 1248 BuildSourceExportClosureTask( |
| 1195 InternalAnalysisContext context, AnalysisTarget target) | 1249 InternalAnalysisContext context, AnalysisTarget target) |
| 1196 : super(context, target); | 1250 : super(context, target); |
| 1197 | 1251 |
| 1198 @override | 1252 @override |
| 1199 TaskDescriptor get descriptor => DESCRIPTOR; | 1253 TaskDescriptor get descriptor => DESCRIPTOR; |
| 1200 | 1254 |
| 1201 @override | 1255 @override |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1236 class BuildSourceImportExportClosureTask extends SourceBasedAnalysisTask { | 1290 class BuildSourceImportExportClosureTask extends SourceBasedAnalysisTask { |
| 1237 /** | 1291 /** |
| 1238 * The name of the import/export closure. | 1292 * The name of the import/export closure. |
| 1239 */ | 1293 */ |
| 1240 static const String IMPORT_EXPORT_INPUT = 'IMPORT_EXPORT_INPUT'; | 1294 static const String IMPORT_EXPORT_INPUT = 'IMPORT_EXPORT_INPUT'; |
| 1241 | 1295 |
| 1242 /** | 1296 /** |
| 1243 * The task descriptor describing this kind of task. | 1297 * The task descriptor describing this kind of task. |
| 1244 */ | 1298 */ |
| 1245 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1299 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1246 'BuildSourceImportExportClosureTask', createTask, buildInputs, | 1300 'BuildSourceImportExportClosureTask', |
| 1301 createTask, | |
| 1302 buildInputs, | |
| 1247 <ResultDescriptor>[IMPORT_EXPORT_SOURCE_CLOSURE, IS_CLIENT]); | 1303 <ResultDescriptor>[IMPORT_EXPORT_SOURCE_CLOSURE, IS_CLIENT]); |
| 1248 | 1304 |
| 1249 BuildSourceImportExportClosureTask( | 1305 BuildSourceImportExportClosureTask( |
| 1250 InternalAnalysisContext context, AnalysisTarget target) | 1306 InternalAnalysisContext context, AnalysisTarget target) |
| 1251 : super(context, target); | 1307 : super(context, target); |
| 1252 | 1308 |
| 1253 @override | 1309 @override |
| 1254 TaskDescriptor get descriptor => DESCRIPTOR; | 1310 TaskDescriptor get descriptor => DESCRIPTOR; |
| 1255 | 1311 |
| 1256 @override | 1312 @override |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1298 | 1354 |
| 1299 /** | 1355 /** |
| 1300 * The [PUBLIC_NAMESPACE] input of the `dart:async` library. | 1356 * The [PUBLIC_NAMESPACE] input of the `dart:async` library. |
| 1301 */ | 1357 */ |
| 1302 static const String ASYNC_INPUT = 'ASYNC_INPUT'; | 1358 static const String ASYNC_INPUT = 'ASYNC_INPUT'; |
| 1303 | 1359 |
| 1304 /** | 1360 /** |
| 1305 * The task descriptor describing this kind of task. | 1361 * The task descriptor describing this kind of task. |
| 1306 */ | 1362 */ |
| 1307 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1363 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1308 'BuildTypeProviderTask', createTask, buildInputs, | 1364 'BuildTypeProviderTask', |
| 1365 createTask, | |
| 1366 buildInputs, | |
| 1309 <ResultDescriptor>[TYPE_PROVIDER]); | 1367 <ResultDescriptor>[TYPE_PROVIDER]); |
| 1310 | 1368 |
| 1311 BuildTypeProviderTask( | 1369 BuildTypeProviderTask( |
| 1312 InternalAnalysisContext context, AnalysisContextTarget target) | 1370 InternalAnalysisContext context, AnalysisContextTarget target) |
| 1313 : super(context, target); | 1371 : super(context, target); |
| 1314 | 1372 |
| 1315 @override | 1373 @override |
| 1316 TaskDescriptor get descriptor => DESCRIPTOR; | 1374 TaskDescriptor get descriptor => DESCRIPTOR; |
| 1317 | 1375 |
| 1318 @override | 1376 @override |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1358 * The name of the [RESOLVED_UNIT5] input. | 1416 * The name of the [RESOLVED_UNIT5] input. |
| 1359 */ | 1417 */ |
| 1360 static const String UNIT_INPUT = 'UNIT_INPUT'; | 1418 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 1361 | 1419 |
| 1362 /** | 1420 /** |
| 1363 * The name of the [TYPE_PROVIDER] input. | 1421 * The name of the [TYPE_PROVIDER] input. |
| 1364 */ | 1422 */ |
| 1365 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 1423 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 1366 | 1424 |
| 1367 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1425 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1368 'ComputeConstantDependenciesTask', createTask, buildInputs, | 1426 'ComputeConstantDependenciesTask', |
| 1427 createTask, | |
| 1428 buildInputs, | |
| 1369 <ResultDescriptor>[CONSTANT_DEPENDENCIES]); | 1429 <ResultDescriptor>[CONSTANT_DEPENDENCIES]); |
| 1370 | 1430 |
| 1371 ComputeConstantDependenciesTask( | 1431 ComputeConstantDependenciesTask( |
| 1372 InternalAnalysisContext context, ConstantEvaluationTarget constant) | 1432 InternalAnalysisContext context, ConstantEvaluationTarget constant) |
| 1373 : super(context, constant); | 1433 : super(context, constant); |
| 1374 | 1434 |
| 1375 @override | 1435 @override |
| 1376 TaskDescriptor get descriptor => DESCRIPTOR; | 1436 TaskDescriptor get descriptor => DESCRIPTOR; |
| 1377 | 1437 |
| 1378 @override | 1438 @override |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1444 * before the target. | 1504 * before the target. |
| 1445 */ | 1505 */ |
| 1446 static const String DEPENDENCIES_INPUT = 'DEPENDENCIES_INPUT'; | 1506 static const String DEPENDENCIES_INPUT = 'DEPENDENCIES_INPUT'; |
| 1447 | 1507 |
| 1448 /** | 1508 /** |
| 1449 * The name of the [TYPE_PROVIDER] input. | 1509 * The name of the [TYPE_PROVIDER] input. |
| 1450 */ | 1510 */ |
| 1451 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 1511 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 1452 | 1512 |
| 1453 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1513 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1454 'ComputeConstantValueTask', createTask, buildInputs, | 1514 'ComputeConstantValueTask', |
| 1515 createTask, | |
| 1516 buildInputs, | |
| 1455 <ResultDescriptor>[CONSTANT_VALUE]); | 1517 <ResultDescriptor>[CONSTANT_VALUE]); |
| 1456 | 1518 |
| 1457 ComputeConstantValueTask( | 1519 ComputeConstantValueTask( |
| 1458 InternalAnalysisContext context, ConstantEvaluationTarget constant) | 1520 InternalAnalysisContext context, ConstantEvaluationTarget constant) |
| 1459 : super(context, constant); | 1521 : super(context, constant); |
| 1460 | 1522 |
| 1461 @override | 1523 @override |
| 1462 TaskDescriptor get descriptor => DESCRIPTOR; | 1524 TaskDescriptor get descriptor => DESCRIPTOR; |
| 1463 | 1525 |
| 1464 @override | 1526 @override |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1558 } | 1620 } |
| 1559 | 1621 |
| 1560 /** | 1622 /** |
| 1561 * A task that computes a list of the libraries containing the target source. | 1623 * A task that computes a list of the libraries containing the target source. |
| 1562 */ | 1624 */ |
| 1563 class ContainingLibrariesTask extends SourceBasedAnalysisTask { | 1625 class ContainingLibrariesTask extends SourceBasedAnalysisTask { |
| 1564 /** | 1626 /** |
| 1565 * The task descriptor describing this kind of task. | 1627 * The task descriptor describing this kind of task. |
| 1566 */ | 1628 */ |
| 1567 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1629 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1568 'ContainingLibrariesTask', createTask, buildInputs, | 1630 'ContainingLibrariesTask', |
| 1631 createTask, | |
| 1632 buildInputs, | |
| 1569 <ResultDescriptor>[CONTAINING_LIBRARIES]); | 1633 <ResultDescriptor>[CONTAINING_LIBRARIES]); |
| 1570 | 1634 |
| 1571 ContainingLibrariesTask( | 1635 ContainingLibrariesTask( |
| 1572 InternalAnalysisContext context, AnalysisTarget target) | 1636 InternalAnalysisContext context, AnalysisTarget target) |
| 1573 : super(context, target); | 1637 : super(context, target); |
| 1574 | 1638 |
| 1575 @override | 1639 @override |
| 1576 TaskDescriptor get descriptor => DESCRIPTOR; | 1640 TaskDescriptor get descriptor => DESCRIPTOR; |
| 1577 | 1641 |
| 1578 @override | 1642 @override |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1767 * input descriptors describing those inputs for a task with the | 1831 * input descriptors describing those inputs for a task with the |
| 1768 * given [target]. | 1832 * given [target]. |
| 1769 */ | 1833 */ |
| 1770 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 1834 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 1771 Source source = target; | 1835 Source source = target; |
| 1772 return <String, TaskInput>{ | 1836 return <String, TaskInput>{ |
| 1773 BUILD_DIRECTIVES_ERRORS_INPUT: BUILD_DIRECTIVES_ERRORS.of(source), | 1837 BUILD_DIRECTIVES_ERRORS_INPUT: BUILD_DIRECTIVES_ERRORS.of(source), |
| 1774 BUILD_LIBRARY_ERRORS_INPUT: BUILD_LIBRARY_ERRORS.of(source), | 1838 BUILD_LIBRARY_ERRORS_INPUT: BUILD_LIBRARY_ERRORS.of(source), |
| 1775 PARSE_ERRORS_INPUT: PARSE_ERRORS.of(source), | 1839 PARSE_ERRORS_INPUT: PARSE_ERRORS.of(source), |
| 1776 SCAN_ERRORS_INPUT: SCAN_ERRORS.of(source), | 1840 SCAN_ERRORS_INPUT: SCAN_ERRORS.of(source), |
| 1777 LIBRARY_UNIT_ERRORS_INPUT: CONTAINING_LIBRARIES | 1841 LIBRARY_UNIT_ERRORS_INPUT: |
| 1778 .of(source) | 1842 CONTAINING_LIBRARIES.of(source).toMap((Source library) { |
| 1779 .toMap((Source library) { | |
| 1780 LibrarySpecificUnit unit = new LibrarySpecificUnit(library, source); | 1843 LibrarySpecificUnit unit = new LibrarySpecificUnit(library, source); |
| 1781 return LIBRARY_UNIT_ERRORS.of(unit); | 1844 return LIBRARY_UNIT_ERRORS.of(unit); |
| 1782 }) | 1845 }) |
| 1783 }; | 1846 }; |
| 1784 } | 1847 } |
| 1785 | 1848 |
| 1786 /** | 1849 /** |
| 1787 * Create a [DartErrorsTask] based on the given [target] in the given | 1850 * Create a [DartErrorsTask] based on the given [target] in the given |
| 1788 * [context]. | 1851 * [context]. |
| 1789 */ | 1852 */ |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1804 | 1867 |
| 1805 /** | 1868 /** |
| 1806 * The name of the [CONSTANT_VALUE] input. | 1869 * The name of the [CONSTANT_VALUE] input. |
| 1807 */ | 1870 */ |
| 1808 static const String CONSTANT_VALUES = 'CONSTANT_VALUES'; | 1871 static const String CONSTANT_VALUES = 'CONSTANT_VALUES'; |
| 1809 | 1872 |
| 1810 /** | 1873 /** |
| 1811 * The task descriptor describing this kind of task. | 1874 * The task descriptor describing this kind of task. |
| 1812 */ | 1875 */ |
| 1813 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1876 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1814 'EvaluateUnitConstantsTask', createTask, buildInputs, | 1877 'EvaluateUnitConstantsTask', |
| 1878 createTask, | |
| 1879 buildInputs, | |
| 1815 <ResultDescriptor>[RESOLVED_UNIT]); | 1880 <ResultDescriptor>[RESOLVED_UNIT]); |
| 1816 | 1881 |
| 1817 EvaluateUnitConstantsTask(AnalysisContext context, LibrarySpecificUnit target) | 1882 EvaluateUnitConstantsTask(AnalysisContext context, LibrarySpecificUnit target) |
| 1818 : super(context, target); | 1883 : super(context, target); |
| 1819 | 1884 |
| 1820 @override | 1885 @override |
| 1821 TaskDescriptor get descriptor => DESCRIPTOR; | 1886 TaskDescriptor get descriptor => DESCRIPTOR; |
| 1822 | 1887 |
| 1823 @override | 1888 @override |
| 1824 void internalPerform() { | 1889 void internalPerform() { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1962 class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { | 2027 class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { |
| 1963 /** | 2028 /** |
| 1964 * The name of the [RESOLVED_UNIT5] input. | 2029 * The name of the [RESOLVED_UNIT5] input. |
| 1965 */ | 2030 */ |
| 1966 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2031 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 1967 | 2032 |
| 1968 /** | 2033 /** |
| 1969 * The task descriptor describing this kind of task. | 2034 * The task descriptor describing this kind of task. |
| 1970 */ | 2035 */ |
| 1971 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2036 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1972 'GatherUsedImportedElementsTask', createTask, buildInputs, | 2037 'GatherUsedImportedElementsTask', |
| 2038 createTask, | |
| 2039 buildInputs, | |
| 1973 <ResultDescriptor>[USED_IMPORTED_ELEMENTS]); | 2040 <ResultDescriptor>[USED_IMPORTED_ELEMENTS]); |
| 1974 | 2041 |
| 1975 GatherUsedImportedElementsTask( | 2042 GatherUsedImportedElementsTask( |
| 1976 InternalAnalysisContext context, AnalysisTarget target) | 2043 InternalAnalysisContext context, AnalysisTarget target) |
| 1977 : super(context, target); | 2044 : super(context, target); |
| 1978 | 2045 |
| 1979 @override | 2046 @override |
| 1980 TaskDescriptor get descriptor => DESCRIPTOR; | 2047 TaskDescriptor get descriptor => DESCRIPTOR; |
| 1981 | 2048 |
| 1982 @override | 2049 @override |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2022 class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { | 2089 class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { |
| 2023 /** | 2090 /** |
| 2024 * The name of the [RESOLVED_UNIT5] input. | 2091 * The name of the [RESOLVED_UNIT5] input. |
| 2025 */ | 2092 */ |
| 2026 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2093 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2027 | 2094 |
| 2028 /** | 2095 /** |
| 2029 * The task descriptor describing this kind of task. | 2096 * The task descriptor describing this kind of task. |
| 2030 */ | 2097 */ |
| 2031 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2098 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2032 'GatherUsedLocalElementsTask', createTask, buildInputs, | 2099 'GatherUsedLocalElementsTask', |
| 2100 createTask, | |
| 2101 buildInputs, | |
| 2033 <ResultDescriptor>[USED_LOCAL_ELEMENTS]); | 2102 <ResultDescriptor>[USED_LOCAL_ELEMENTS]); |
| 2034 | 2103 |
| 2035 GatherUsedLocalElementsTask( | 2104 GatherUsedLocalElementsTask( |
| 2036 InternalAnalysisContext context, AnalysisTarget target) | 2105 InternalAnalysisContext context, AnalysisTarget target) |
| 2037 : super(context, target); | 2106 : super(context, target); |
| 2038 | 2107 |
| 2039 @override | 2108 @override |
| 2040 TaskDescriptor get descriptor => DESCRIPTOR; | 2109 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2041 | 2110 |
| 2042 @override | 2111 @override |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2207 | 2276 |
| 2208 /** | 2277 /** |
| 2209 * A task computes all of the errors of all of the units for a single | 2278 * A task computes all of the errors of all of the units for a single |
| 2210 * library source and sets the [LIBRARY_ERRORS_READY] flag. | 2279 * library source and sets the [LIBRARY_ERRORS_READY] flag. |
| 2211 */ | 2280 */ |
| 2212 class LibraryErrorsReadyTask extends SourceBasedAnalysisTask { | 2281 class LibraryErrorsReadyTask extends SourceBasedAnalysisTask { |
| 2213 /** | 2282 /** |
| 2214 * The task descriptor describing this kind of task. | 2283 * The task descriptor describing this kind of task. |
| 2215 */ | 2284 */ |
| 2216 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2285 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2217 'LibraryErrorsReadyTask', createTask, buildInputs, | 2286 'LibraryErrorsReadyTask', |
| 2287 createTask, | |
| 2288 buildInputs, | |
| 2218 <ResultDescriptor>[LIBRARY_ERRORS_READY]); | 2289 <ResultDescriptor>[LIBRARY_ERRORS_READY]); |
| 2219 | 2290 |
| 2220 LibraryErrorsReadyTask(InternalAnalysisContext context, AnalysisTarget target) | 2291 LibraryErrorsReadyTask(InternalAnalysisContext context, AnalysisTarget target) |
| 2221 : super(context, target); | 2292 : super(context, target); |
| 2222 | 2293 |
| 2223 @override | 2294 @override |
| 2224 TaskDescriptor get descriptor => DESCRIPTOR; | 2295 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2225 | 2296 |
| 2226 @override | 2297 @override |
| 2227 void internalPerform() { | 2298 void internalPerform() { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2280 | 2351 |
| 2281 /** | 2352 /** |
| 2282 * The name of the [VERIFY_ERRORS] input. | 2353 * The name of the [VERIFY_ERRORS] input. |
| 2283 */ | 2354 */ |
| 2284 static const String VERIFY_ERRORS_INPUT = 'VERIFY_ERRORS'; | 2355 static const String VERIFY_ERRORS_INPUT = 'VERIFY_ERRORS'; |
| 2285 | 2356 |
| 2286 /** | 2357 /** |
| 2287 * The task descriptor describing this kind of task. | 2358 * The task descriptor describing this kind of task. |
| 2288 */ | 2359 */ |
| 2289 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2360 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2290 'LibraryUnitErrorsTask', createTask, buildInputs, | 2361 'LibraryUnitErrorsTask', |
| 2362 createTask, | |
| 2363 buildInputs, | |
| 2291 <ResultDescriptor>[LIBRARY_UNIT_ERRORS]); | 2364 <ResultDescriptor>[LIBRARY_UNIT_ERRORS]); |
| 2292 | 2365 |
| 2293 LibraryUnitErrorsTask(InternalAnalysisContext context, AnalysisTarget target) | 2366 LibraryUnitErrorsTask(InternalAnalysisContext context, AnalysisTarget target) |
| 2294 : super(context, target); | 2367 : super(context, target); |
| 2295 | 2368 |
| 2296 @override | 2369 @override |
| 2297 TaskDescriptor get descriptor => DESCRIPTOR; | 2370 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2298 | 2371 |
| 2299 @override | 2372 @override |
| 2300 void internalPerform() { | 2373 void internalPerform() { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2356 'MODIFICATION_TIME_INPUT_NAME'; | 2429 'MODIFICATION_TIME_INPUT_NAME'; |
| 2357 | 2430 |
| 2358 /** | 2431 /** |
| 2359 * The name of the input whose value is the token stream produced for the file . | 2432 * The name of the input whose value is the token stream produced for the file . |
| 2360 */ | 2433 */ |
| 2361 static const String TOKEN_STREAM_INPUT_NAME = 'TOKEN_STREAM_INPUT_NAME'; | 2434 static const String TOKEN_STREAM_INPUT_NAME = 'TOKEN_STREAM_INPUT_NAME'; |
| 2362 | 2435 |
| 2363 /** | 2436 /** |
| 2364 * The task descriptor describing this kind of task. | 2437 * The task descriptor describing this kind of task. |
| 2365 */ | 2438 */ |
| 2366 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor('ParseDartTask', | 2439 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2367 createTask, buildInputs, <ResultDescriptor>[ | 2440 'ParseDartTask', createTask, buildInputs, <ResultDescriptor>[ |
| 2368 EXPLICITLY_IMPORTED_LIBRARIES, | 2441 EXPLICITLY_IMPORTED_LIBRARIES, |
| 2369 EXPORTED_LIBRARIES, | 2442 EXPORTED_LIBRARIES, |
| 2370 IMPORTED_LIBRARIES, | 2443 IMPORTED_LIBRARIES, |
| 2371 INCLUDED_PARTS, | 2444 INCLUDED_PARTS, |
| 2372 PARSE_ERRORS, | 2445 PARSE_ERRORS, |
| 2373 PARSED_UNIT, | 2446 PARSED_UNIT, |
| 2374 SOURCE_KIND, | 2447 SOURCE_KIND, |
| 2375 UNITS | 2448 UNITS |
| 2376 ]); | 2449 ]); |
| 2377 | 2450 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2676 | 2749 |
| 2677 /** | 2750 /** |
| 2678 * The name of the list of [RESOLVED_UNIT5] input. | 2751 * The name of the list of [RESOLVED_UNIT5] input. |
| 2679 */ | 2752 */ |
| 2680 static const String UNITS_INPUT = 'UNITS_INPUT'; | 2753 static const String UNITS_INPUT = 'UNITS_INPUT'; |
| 2681 | 2754 |
| 2682 /** | 2755 /** |
| 2683 * The task descriptor describing this kind of task. | 2756 * The task descriptor describing this kind of task. |
| 2684 */ | 2757 */ |
| 2685 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2758 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2686 'ResolveLibraryReferencesTask', createTask, buildInputs, | 2759 'ResolveLibraryReferencesTask', |
| 2760 createTask, | |
| 2761 buildInputs, | |
| 2687 <ResultDescriptor>[LIBRARY_ELEMENT, REFERENCED_NAMES]); | 2762 <ResultDescriptor>[LIBRARY_ELEMENT, REFERENCED_NAMES]); |
| 2688 | 2763 |
| 2689 ResolveLibraryReferencesTask( | 2764 ResolveLibraryReferencesTask( |
| 2690 InternalAnalysisContext context, AnalysisTarget target) | 2765 InternalAnalysisContext context, AnalysisTarget target) |
| 2691 : super(context, target); | 2766 : super(context, target); |
| 2692 | 2767 |
| 2693 @override | 2768 @override |
| 2694 TaskDescriptor get descriptor => DESCRIPTOR; | 2769 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2695 | 2770 |
| 2696 @override | 2771 @override |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2748 class ResolveLibraryTypeNamesTask extends SourceBasedAnalysisTask { | 2823 class ResolveLibraryTypeNamesTask extends SourceBasedAnalysisTask { |
| 2749 /** | 2824 /** |
| 2750 * The name of the [LIBRARY_ELEMENT4] input. | 2825 * The name of the [LIBRARY_ELEMENT4] input. |
| 2751 */ | 2826 */ |
| 2752 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 2827 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 2753 | 2828 |
| 2754 /** | 2829 /** |
| 2755 * The task descriptor describing this kind of task. | 2830 * The task descriptor describing this kind of task. |
| 2756 */ | 2831 */ |
| 2757 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2832 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2758 'ResolveLibraryTypeNamesTask', createTask, buildInputs, | 2833 'ResolveLibraryTypeNamesTask', |
| 2834 createTask, | |
| 2835 buildInputs, | |
| 2759 <ResultDescriptor>[LIBRARY_ELEMENT5]); | 2836 <ResultDescriptor>[LIBRARY_ELEMENT5]); |
| 2760 | 2837 |
| 2761 ResolveLibraryTypeNamesTask( | 2838 ResolveLibraryTypeNamesTask( |
| 2762 InternalAnalysisContext context, AnalysisTarget target) | 2839 InternalAnalysisContext context, AnalysisTarget target) |
| 2763 : super(context, target); | 2840 : super(context, target); |
| 2764 | 2841 |
| 2765 @override | 2842 @override |
| 2766 TaskDescriptor get descriptor => DESCRIPTOR; | 2843 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2767 | 2844 |
| 2768 @override | 2845 @override |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2811 | 2888 |
| 2812 /** | 2889 /** |
| 2813 * The name of the [TYPE_PROVIDER] input. | 2890 * The name of the [TYPE_PROVIDER] input. |
| 2814 */ | 2891 */ |
| 2815 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 2892 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 2816 | 2893 |
| 2817 /** | 2894 /** |
| 2818 * The task descriptor describing this kind of task. | 2895 * The task descriptor describing this kind of task. |
| 2819 */ | 2896 */ |
| 2820 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2897 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2821 'ResolveUnitReferencesTask', createTask, buildInputs, <ResultDescriptor>[ | 2898 'ResolveUnitReferencesTask', |
| 2822 RESOLVE_REFERENCES_ERRORS, | 2899 createTask, |
| 2823 RESOLVED_UNIT5 | 2900 buildInputs, |
| 2824 ]); | 2901 <ResultDescriptor>[RESOLVE_REFERENCES_ERRORS, RESOLVED_UNIT5]); |
| 2825 | 2902 |
| 2826 ResolveUnitReferencesTask( | 2903 ResolveUnitReferencesTask( |
| 2827 InternalAnalysisContext context, AnalysisTarget target) | 2904 InternalAnalysisContext context, AnalysisTarget target) |
| 2828 : super(context, target); | 2905 : super(context, target); |
| 2829 | 2906 |
| 2830 @override | 2907 @override |
| 2831 TaskDescriptor get descriptor => DESCRIPTOR; | 2908 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2832 | 2909 |
| 2833 @override | 2910 @override |
| 2834 void internalPerform() { | 2911 void internalPerform() { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2900 | 2977 |
| 2901 /** | 2978 /** |
| 2902 * The name of the [TYPE_PROVIDER] input. | 2979 * The name of the [TYPE_PROVIDER] input. |
| 2903 */ | 2980 */ |
| 2904 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 2981 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 2905 | 2982 |
| 2906 /** | 2983 /** |
| 2907 * The task descriptor describing this kind of task. | 2984 * The task descriptor describing this kind of task. |
| 2908 */ | 2985 */ |
| 2909 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2986 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2910 'ResolveUnitTypeNamesTask', createTask, buildInputs, <ResultDescriptor>[ | 2987 'ResolveUnitTypeNamesTask', |
| 2911 RESOLVE_TYPE_NAMES_ERRORS, | 2988 createTask, |
| 2912 RESOLVED_UNIT3 | 2989 buildInputs, |
| 2913 ]); | 2990 <ResultDescriptor>[RESOLVE_TYPE_NAMES_ERRORS, RESOLVED_UNIT3]); |
| 2914 | 2991 |
| 2915 ResolveUnitTypeNamesTask( | 2992 ResolveUnitTypeNamesTask( |
| 2916 InternalAnalysisContext context, AnalysisTarget target) | 2993 InternalAnalysisContext context, AnalysisTarget target) |
| 2917 : super(context, target); | 2994 : super(context, target); |
| 2918 | 2995 |
| 2919 @override | 2996 @override |
| 2920 TaskDescriptor get descriptor => DESCRIPTOR; | 2997 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2921 | 2998 |
| 2922 @override | 2999 @override |
| 2923 void internalPerform() { | 3000 void internalPerform() { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2985 | 3062 |
| 2986 /** | 3063 /** |
| 2987 * The name of the [TYPE_PROVIDER] input. | 3064 * The name of the [TYPE_PROVIDER] input. |
| 2988 */ | 3065 */ |
| 2989 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 3066 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 2990 | 3067 |
| 2991 /** | 3068 /** |
| 2992 * The task descriptor describing this kind of task. | 3069 * The task descriptor describing this kind of task. |
| 2993 */ | 3070 */ |
| 2994 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 3071 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2995 'ResolveVariableReferencesTask', createTask, buildInputs, | 3072 'ResolveVariableReferencesTask', |
| 3073 createTask, | |
| 3074 buildInputs, | |
| 2996 <ResultDescriptor>[RESOLVED_UNIT4, VARIABLE_REFERENCE_ERRORS]); | 3075 <ResultDescriptor>[RESOLVED_UNIT4, VARIABLE_REFERENCE_ERRORS]); |
| 2997 | 3076 |
| 2998 ResolveVariableReferencesTask( | 3077 ResolveVariableReferencesTask( |
| 2999 InternalAnalysisContext context, AnalysisTarget target) | 3078 InternalAnalysisContext context, AnalysisTarget target) |
| 3000 : super(context, target); | 3079 : super(context, target); |
| 3001 | 3080 |
| 3002 @override | 3081 @override |
| 3003 TaskDescriptor get descriptor => DESCRIPTOR; | 3082 TaskDescriptor get descriptor => DESCRIPTOR; |
| 3004 | 3083 |
| 3005 @override | 3084 @override |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3057 */ | 3136 */ |
| 3058 class ScanDartTask extends SourceBasedAnalysisTask { | 3137 class ScanDartTask extends SourceBasedAnalysisTask { |
| 3059 /** | 3138 /** |
| 3060 * The name of the input whose value is the content of the file. | 3139 * The name of the input whose value is the content of the file. |
| 3061 */ | 3140 */ |
| 3062 static const String CONTENT_INPUT_NAME = 'CONTENT_INPUT_NAME'; | 3141 static const String CONTENT_INPUT_NAME = 'CONTENT_INPUT_NAME'; |
| 3063 | 3142 |
| 3064 /** | 3143 /** |
| 3065 * The task descriptor describing this kind of task. | 3144 * The task descriptor describing this kind of task. |
| 3066 */ | 3145 */ |
| 3067 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor('ScanDartTask', | 3146 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3068 createTask, buildInputs, <ResultDescriptor>[ | 3147 'ScanDartTask', |
| 3069 LINE_INFO, | 3148 createTask, |
| 3070 SCAN_ERRORS, | 3149 buildInputs, |
| 3071 TOKEN_STREAM | 3150 <ResultDescriptor>[LINE_INFO, SCAN_ERRORS, TOKEN_STREAM]); |
| 3072 ]); | |
| 3073 | 3151 |
| 3074 /** | 3152 /** |
| 3075 * Initialize a newly created task to access the content of the source | 3153 * Initialize a newly created task to access the content of the source |
| 3076 * associated with the given [target] in the given [context]. | 3154 * associated with the given [target] in the given [context]. |
| 3077 */ | 3155 */ |
| 3078 ScanDartTask(InternalAnalysisContext context, AnalysisTarget target) | 3156 ScanDartTask(InternalAnalysisContext context, AnalysisTarget target) |
| 3079 : super(context, target); | 3157 : super(context, target); |
| 3080 | 3158 |
| 3081 @override | 3159 @override |
| 3082 TaskDescriptor get descriptor => DESCRIPTOR; | 3160 TaskDescriptor get descriptor => DESCRIPTOR; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 3103 DartScript script = target; | 3181 DartScript script = target; |
| 3104 List<ScriptFragment> fragments = script.fragments; | 3182 List<ScriptFragment> fragments = script.fragments; |
| 3105 if (fragments.length < 1) { | 3183 if (fragments.length < 1) { |
| 3106 throw new AnalysisException('Cannot scan scripts with no fragments'); | 3184 throw new AnalysisException('Cannot scan scripts with no fragments'); |
| 3107 } else if (fragments.length > 1) { | 3185 } else if (fragments.length > 1) { |
| 3108 throw new AnalysisException( | 3186 throw new AnalysisException( |
| 3109 'Cannot scan scripts with multiple fragments'); | 3187 'Cannot scan scripts with multiple fragments'); |
| 3110 } | 3188 } |
| 3111 ScriptFragment fragment = fragments[0]; | 3189 ScriptFragment fragment = fragments[0]; |
| 3112 | 3190 |
| 3113 Scanner scanner = new Scanner(source, | 3191 Scanner scanner = new Scanner( |
| 3192 source, | |
| 3114 new SubSequenceReader(fragment.content, fragment.offset), | 3193 new SubSequenceReader(fragment.content, fragment.offset), |
| 3115 errorListener); | 3194 errorListener); |
| 3116 scanner.setSourceStart(fragment.line, fragment.column); | 3195 scanner.setSourceStart(fragment.line, fragment.column); |
| 3117 scanner.preserveComments = context.analysisOptions.preserveComments; | 3196 scanner.preserveComments = context.analysisOptions.preserveComments; |
| 3118 | 3197 |
| 3119 outputs[TOKEN_STREAM] = scanner.tokenize(); | 3198 outputs[TOKEN_STREAM] = scanner.tokenize(); |
| 3120 outputs[LINE_INFO] = new LineInfo(scanner.lineStarts); | 3199 outputs[LINE_INFO] = new LineInfo(scanner.lineStarts); |
| 3121 outputs[SCAN_ERRORS] = removeDuplicateErrors(errorListener.errors); | 3200 outputs[SCAN_ERRORS] = removeDuplicateErrors(errorListener.errors); |
| 3122 } else if (target is Source) { | 3201 } else if (target is Source) { |
| 3123 String content = getRequiredInput(CONTENT_INPUT_NAME); | 3202 String content = getRequiredInput(CONTENT_INPUT_NAME); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3211 validateDirectives(unit); | 3290 validateDirectives(unit); |
| 3212 // | 3291 // |
| 3213 // Use the ConstantVerifier to compute errors. | 3292 // Use the ConstantVerifier to compute errors. |
| 3214 // | 3293 // |
| 3215 ConstantVerifier constantVerifier = new ConstantVerifier( | 3294 ConstantVerifier constantVerifier = new ConstantVerifier( |
| 3216 errorReporter, libraryElement, typeProvider, context.declaredVariables); | 3295 errorReporter, libraryElement, typeProvider, context.declaredVariables); |
| 3217 unit.accept(constantVerifier); | 3296 unit.accept(constantVerifier); |
| 3218 // | 3297 // |
| 3219 // Use the ErrorVerifier to compute errors. | 3298 // Use the ErrorVerifier to compute errors. |
| 3220 // | 3299 // |
| 3221 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, | 3300 ErrorVerifier errorVerifier = new ErrorVerifier( |
| 3222 libraryElement, typeProvider, new InheritanceManager(libraryElement), | 3301 errorReporter, |
| 3302 libraryElement, | |
| 3303 typeProvider, | |
| 3304 new InheritanceManager(libraryElement), | |
| 3223 context.analysisOptions.enableSuperMixins); | 3305 context.analysisOptions.enableSuperMixins); |
| 3224 unit.accept(errorVerifier); | 3306 unit.accept(errorVerifier); |
| 3225 // | 3307 // |
| 3226 // Record outputs. | 3308 // Record outputs. |
| 3227 // | 3309 // |
| 3228 outputs[VERIFY_ERRORS] = removeDuplicateErrors(errorListener.errors); | 3310 outputs[VERIFY_ERRORS] = removeDuplicateErrors(errorListener.errors); |
| 3229 } | 3311 } |
| 3230 | 3312 |
| 3231 /** | 3313 /** |
| 3232 * Check each directive in the given [unit] to see if the referenced source | 3314 * Check each directive in the given [unit] to see if the referenced source |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3403 | 3485 |
| 3404 @override | 3486 @override |
| 3405 bool moveNext() { | 3487 bool moveNext() { |
| 3406 if (_newSources.isEmpty) { | 3488 if (_newSources.isEmpty) { |
| 3407 return false; | 3489 return false; |
| 3408 } | 3490 } |
| 3409 currentTarget = _newSources.removeLast(); | 3491 currentTarget = _newSources.removeLast(); |
| 3410 return true; | 3492 return true; |
| 3411 } | 3493 } |
| 3412 } | 3494 } |
| OLD | NEW |