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

Side by Side Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 2571373002: Workaround for accessing part sources while resolving a library. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/analysis/driver_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:typed_data'; 7 import 'dart:typed_data';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/element/element.dart' show CompilationUnitElement; 10 import 'package:analyzer/dart/element/element.dart' show CompilationUnitElement;
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 // Prepare the library file - the file itself, or the known library. 646 // Prepare the library file - the file itself, or the known library.
647 FileState libraryFile = getLibraryFile(file); 647 FileState libraryFile = getLibraryFile(file);
648 if (libraryFile == null) { 648 if (libraryFile == null) {
649 return null; 649 return null;
650 } 650 }
651 651
652 _LibraryContext libraryContext = _createLibraryContext(libraryFile); 652 _LibraryContext libraryContext = _createLibraryContext(libraryFile);
653 AnalysisContext analysisContext = _createAnalysisContext(libraryContext); 653 AnalysisContext analysisContext = _createAnalysisContext(libraryContext);
654 try { 654 try {
655 analysisContext.setContents(file.source, file.content); 655 analysisContext.setContents(file.source, file.content);
656
657 // TODO(scheglov) Remove this.
658 // https://github.com/dart-lang/sdk/issues/28110
659 analysisContext.setContents(libraryFile.source, libraryFile.content);
660 for (FileState part in libraryFile.partedFiles) {
661 if (part.exists) {
662 analysisContext.setContents(part.source, part.content);
663 }
664 }
665
656 CompilationUnit resolvedUnit = analysisContext.resolveCompilationUnit2( 666 CompilationUnit resolvedUnit = analysisContext.resolveCompilationUnit2(
657 file.source, libraryFile.source); 667 file.source, libraryFile.source);
658 List<AnalysisError> errors = analysisContext.computeErrors(file.source); 668 List<AnalysisError> errors = analysisContext.computeErrors(file.source);
659 AnalysisDriverUnitIndexBuilder index = indexUnit(resolvedUnit); 669 AnalysisDriverUnitIndexBuilder index = indexUnit(resolvedUnit);
660 670
661 // Store the result into the cache. 671 // Store the result into the cache.
662 List<int> bytes; 672 List<int> bytes;
663 { 673 {
664 bytes = new AnalysisDriverResolvedUnitBuilder( 674 bytes = new AnalysisDriverResolvedUnitBuilder(
665 errors: errors 675 errors: errors
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 libraryDeclarations.add(new TopLevelDeclarationInSource( 1594 libraryDeclarations.add(new TopLevelDeclarationInSource(
1585 file.source, declaration, isExported)); 1595 file.source, declaration, isExported));
1586 } 1596 }
1587 } 1597 }
1588 } 1598 }
1589 1599
1590 // We're not done yet. 1600 // We're not done yet.
1591 return false; 1601 return false;
1592 } 1602 }
1593 } 1603 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/analysis/driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698