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

Side by Side Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 2235373003: Fix summary handling of unresolved imports, exports, and parts. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Simplify `allowMissingFiles` Created 4 years, 4 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) 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/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 */ 1485 */
1486 static const String DEFINING_UNIT_INPUT = 'DEFINING_UNIT_INPUT'; 1486 static const String DEFINING_UNIT_INPUT = 'DEFINING_UNIT_INPUT';
1487 1487
1488 /** 1488 /**
1489 * The name of the input whose value is a list of built [RESOLVED_UNIT1]s 1489 * The name of the input whose value is a list of built [RESOLVED_UNIT1]s
1490 * of the parts sourced by a library. 1490 * of the parts sourced by a library.
1491 */ 1491 */
1492 static const String PARTS_UNIT_INPUT = 'PARTS_UNIT_INPUT'; 1492 static const String PARTS_UNIT_INPUT = 'PARTS_UNIT_INPUT';
1493 1493
1494 /** 1494 /**
1495 * The name of the input whose value is the modification time of the source.
1496 */
1497 static const String MODIFICATION_TIME_INPUT = 'MODIFICATION_TIME_INPUT';
1498
1499 /**
1495 * The task descriptor describing this kind of task. 1500 * The task descriptor describing this kind of task.
1496 */ 1501 */
1497 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 1502 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
1498 'BuildLibraryElementTask', createTask, buildInputs, <ResultDescriptor>[ 1503 'BuildLibraryElementTask', createTask, buildInputs, <ResultDescriptor>[
1499 BUILD_LIBRARY_ERRORS, 1504 BUILD_LIBRARY_ERRORS,
1500 LIBRARY_ELEMENT1, 1505 LIBRARY_ELEMENT1,
1501 IS_LAUNCHABLE 1506 IS_LAUNCHABLE
1502 ]); 1507 ]);
1503 1508
1504 /** 1509 /**
(...skipping 15 matching lines...) Expand all
1520 @override 1525 @override
1521 void internalPerform() { 1526 void internalPerform() {
1522 List<AnalysisError> errors = <AnalysisError>[]; 1527 List<AnalysisError> errors = <AnalysisError>[];
1523 // 1528 //
1524 // Prepare inputs. 1529 // Prepare inputs.
1525 // 1530 //
1526 Source librarySource = getRequiredSource(); 1531 Source librarySource = getRequiredSource();
1527 CompilationUnit definingCompilationUnit = 1532 CompilationUnit definingCompilationUnit =
1528 getRequiredInput(DEFINING_UNIT_INPUT); 1533 getRequiredInput(DEFINING_UNIT_INPUT);
1529 List<CompilationUnit> partUnits = getRequiredInput(PARTS_UNIT_INPUT); 1534 List<CompilationUnit> partUnits = getRequiredInput(PARTS_UNIT_INPUT);
1535 int modificationTime = getRequiredInput(MODIFICATION_TIME_INPUT);
1530 // 1536 //
1531 // Process inputs. 1537 // Process inputs.
1532 // 1538 //
1533 CompilationUnitElementImpl definingCompilationUnitElement = 1539 CompilationUnitElementImpl definingCompilationUnitElement =
1534 definingCompilationUnit.element; 1540 definingCompilationUnit.element;
1535 Map<Source, CompilationUnit> partUnitMap = 1541 Map<Source, CompilationUnit> partUnitMap =
1536 new HashMap<Source, CompilationUnit>(); 1542 new HashMap<Source, CompilationUnit>();
1537 int partLength = partUnits.length; 1543 int partLength = partUnits.length;
1538 for (int i = 0; i < partLength; i++) { 1544 for (int i = 0; i < partLength; i++) {
1539 CompilationUnit partUnit = partUnits[i]; 1545 CompilationUnit partUnit = partUnits[i];
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1640 internalContext.aboutToComputeResult(cacheEntry, LIBRARY_ELEMENT1)) { 1646 internalContext.aboutToComputeResult(cacheEntry, LIBRARY_ELEMENT1)) {
1641 libraryElement = analysisCache.getValue(target, LIBRARY_ELEMENT1); 1647 libraryElement = analysisCache.getValue(target, LIBRARY_ELEMENT1);
1642 } 1648 }
1643 } 1649 }
1644 // 1650 //
1645 // Create a new LibraryElement. 1651 // Create a new LibraryElement.
1646 // 1652 //
1647 if (libraryElement == null) { 1653 if (libraryElement == null) {
1648 libraryElement = 1654 libraryElement =
1649 new LibraryElementImpl.forNode(owningContext, libraryNameNode); 1655 new LibraryElementImpl.forNode(owningContext, libraryNameNode);
1656 libraryElement.synthetic = modificationTime < 0;
1650 libraryElement.definingCompilationUnit = definingCompilationUnitElement; 1657 libraryElement.definingCompilationUnit = definingCompilationUnitElement;
1651 libraryElement.entryPoint = entryPoint; 1658 libraryElement.entryPoint = entryPoint;
1652 libraryElement.parts = sourcedCompilationUnits; 1659 libraryElement.parts = sourcedCompilationUnits;
1653 libraryElement.hasExtUri = _hasExtUri(definingCompilationUnit); 1660 libraryElement.hasExtUri = _hasExtUri(definingCompilationUnit);
1654 BuildLibraryElementUtils.patchTopLevelAccessors(libraryElement); 1661 BuildLibraryElementUtils.patchTopLevelAccessors(libraryElement);
1655 // set the library documentation to the docs associated with the first 1662 // set the library documentation to the docs associated with the first
1656 // directive in the compilation unit. 1663 // directive in the compilation unit.
1657 if (definingCompilationUnit.directives.isNotEmpty) { 1664 if (definingCompilationUnit.directives.isNotEmpty) {
1658 setElementDocumentationComment( 1665 setElementDocumentationComment(
1659 libraryElement, definingCompilationUnit.directives.first); 1666 libraryElement, definingCompilationUnit.directives.first);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 * input descriptors describing those inputs for a task with the given 1745 * input descriptors describing those inputs for a task with the given
1739 * [libSource]. 1746 * [libSource].
1740 */ 1747 */
1741 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 1748 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
1742 Source source = target; 1749 Source source = target;
1743 return <String, TaskInput>{ 1750 return <String, TaskInput>{
1744 DEFINING_UNIT_INPUT: 1751 DEFINING_UNIT_INPUT:
1745 RESOLVED_UNIT1.of(new LibrarySpecificUnit(source, source)), 1752 RESOLVED_UNIT1.of(new LibrarySpecificUnit(source, source)),
1746 PARTS_UNIT_INPUT: INCLUDED_PARTS.of(source).toList((Source unit) { 1753 PARTS_UNIT_INPUT: INCLUDED_PARTS.of(source).toList((Source unit) {
1747 return RESOLVED_UNIT1.of(new LibrarySpecificUnit(source, unit)); 1754 return RESOLVED_UNIT1.of(new LibrarySpecificUnit(source, unit));
1748 }) 1755 }),
1756 MODIFICATION_TIME_INPUT: MODIFICATION_TIME.of(source)
1749 }; 1757 };
1750 } 1758 }
1751 1759
1752 /** 1760 /**
1753 * Create a [BuildLibraryElementTask] based on the given [target] in the 1761 * Create a [BuildLibraryElementTask] based on the given [target] in the
1754 * given [context]. 1762 * given [context].
1755 */ 1763 */
1756 static BuildLibraryElementTask createTask( 1764 static BuildLibraryElementTask createTask(
1757 AnalysisContext context, AnalysisTarget target) { 1765 AnalysisContext context, AnalysisTarget target) {
1758 return new BuildLibraryElementTask(context, target); 1766 return new BuildLibraryElementTask(context, target);
(...skipping 4900 matching lines...) Expand 10 before | Expand all | Expand 10 after
6659 6667
6660 @override 6668 @override
6661 bool moveNext() { 6669 bool moveNext() {
6662 if (_newSources.isEmpty) { 6670 if (_newSources.isEmpty) {
6663 return false; 6671 return false;
6664 } 6672 }
6665 currentTarget = _newSources.removeLast(); 6673 currentTarget = _newSources.removeLast();
6666 return true; 6674 return true;
6667 } 6675 }
6668 } 6676 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_ast_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698