OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 'package:analyzer/context/declared_variables.dart'; | 5 import 'package:analyzer/context/declared_variables.dart'; |
6 import 'package:analyzer/dart/ast/ast.dart'; | 6 import 'package:analyzer/dart/ast/ast.dart'; |
7 import 'package:analyzer/dart/ast/visitor.dart'; | 7 import 'package:analyzer/dart/ast/visitor.dart'; |
8 import 'package:analyzer/dart/element/element.dart'; | 8 import 'package:analyzer/dart/element/element.dart'; |
9 import 'package:analyzer/error/error.dart'; | 9 import 'package:analyzer/error/error.dart'; |
10 import 'package:analyzer/error/listener.dart'; | 10 import 'package:analyzer/error/listener.dart'; |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 partUri, | 467 partUri, |
468 [_library.uriStr, source.uri]); | 468 [_library.uriStr, source.uri]); |
469 } | 469 } |
470 } | 470 } |
471 } | 471 } |
472 } | 472 } |
473 } | 473 } |
474 } | 474 } |
475 } | 475 } |
476 | 476 |
477 if (hasPartDirective && libraryNameNode == null && | 477 if (hasPartDirective && |
| 478 libraryNameNode == null && |
478 !_context.analysisOptions.enableUriInPartOf) { | 479 !_context.analysisOptions.enableUriInPartOf) { |
479 libraryErrorReporter.reportErrorForOffset( | 480 libraryErrorReporter.reportErrorForOffset( |
480 ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART, 0, 0); | 481 ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART, 0, 0); |
481 } | 482 } |
482 | 483 |
483 // | 484 // |
484 // Resolve the relevant directives to the library element. | 485 // Resolve the relevant directives to the library element. |
485 // | 486 // |
486 for (Directive directive in directivesToResolve) { | 487 for (Directive directive in directivesToResolve) { |
487 directive.element = _libraryElement; | 488 directive.element = _libraryElement; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 throw new UnimplementedError(); | 734 throw new UnimplementedError(); |
734 } | 735 } |
735 | 736 |
736 @override | 737 @override |
737 String getContents(Source source) { | 738 String getContents(Source source) { |
738 return _getFileForSource(source).content; | 739 return _getFileForSource(source).content; |
739 } | 740 } |
740 | 741 |
741 @override | 742 @override |
742 bool getExists(Source source) { | 743 bool getExists(Source source) { |
| 744 if (fsState.externalSummaries != null && |
| 745 fsState.externalSummaries.hasUnlinkedUnit(source.uri.toString())) { |
| 746 return true; |
| 747 } |
743 return _getFileForSource(source).exists; | 748 return _getFileForSource(source).exists; |
744 } | 749 } |
745 | 750 |
746 @override | 751 @override |
747 int getModificationStamp(Source source) { | 752 int getModificationStamp(Source source) { |
748 return _getFileForSource(source).exists ? 0 : -1; | 753 return _getFileForSource(source).exists ? 0 : -1; |
749 } | 754 } |
750 | 755 |
751 @override | 756 @override |
752 String setContents(Source source, String contents) { | 757 String setContents(Source source, String contents) { |
753 throw new UnimplementedError(); | 758 throw new UnimplementedError(); |
754 } | 759 } |
755 | 760 |
756 FileState _getFileForSource(Source source) { | 761 FileState _getFileForSource(Source source) { |
757 String path = source.fullName; | 762 String path = source.fullName; |
758 return fsState.getFileForPath(path); | 763 return fsState.getFileForPath(path); |
759 } | 764 } |
760 } | 765 } |
761 | 766 |
762 /** | 767 /** |
763 * Either the name or the source associated with a part-of directive. | 768 * Either the name or the source associated with a part-of directive. |
764 */ | 769 */ |
765 class _NameOrSource { | 770 class _NameOrSource { |
766 final String name; | 771 final String name; |
767 final Source source; | 772 final Source source; |
768 _NameOrSource(this.name, this.source); | 773 _NameOrSource(this.name, this.source); |
769 } | 774 } |
OLD | NEW |