| OLD | NEW |
| 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 library analyzer.src.generated.sdk2; | 5 library analyzer.src.generated.sdk2; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
| 10 | 10 |
| 11 import 'package:analyzer/dart/ast/ast.dart'; | 11 import 'package:analyzer/dart/ast/ast.dart'; |
| 12 import 'package:analyzer/file_system/file_system.dart'; | 12 import 'package:analyzer/file_system/file_system.dart'; |
| 13 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 13 import 'package:analyzer/src/context/context.dart'; | 14 import 'package:analyzer/src/context/context.dart'; |
| 14 import 'package:analyzer/src/dart/scanner/reader.dart'; | 15 import 'package:analyzer/src/dart/scanner/reader.dart'; |
| 15 import 'package:analyzer/src/dart/scanner/scanner.dart'; | 16 import 'package:analyzer/src/dart/scanner/scanner.dart'; |
| 16 import 'package:analyzer/src/generated/engine.dart'; | 17 import 'package:analyzer/src/generated/engine.dart'; |
| 17 import 'package:analyzer/src/generated/error.dart'; | 18 import 'package:analyzer/src/generated/error.dart'; |
| 18 import 'package:analyzer/src/generated/java_core.dart'; | 19 import 'package:analyzer/src/generated/java_core.dart'; |
| 19 import 'package:analyzer/src/generated/java_engine.dart'; | 20 import 'package:analyzer/src/generated/java_engine.dart'; |
| 20 import 'package:analyzer/src/generated/java_engine_io.dart'; | 21 import 'package:analyzer/src/generated/java_engine_io.dart'; |
| 21 import 'package:analyzer/src/generated/parser.dart'; | 22 import 'package:analyzer/src/generated/parser.dart'; |
| 22 import 'package:analyzer/src/generated/sdk.dart'; | 23 import 'package:analyzer/src/generated/sdk.dart'; |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 try { | 590 try { |
| 590 String contents = librariesFile.readAsStringSync(); | 591 String contents = librariesFile.readAsStringSync(); |
| 591 return new SdkLibrariesReader(useDart2jsPaths) | 592 return new SdkLibrariesReader(useDart2jsPaths) |
| 592 .readFromFile(librariesFile, contents); | 593 .readFromFile(librariesFile, contents); |
| 593 } catch (exception, stackTrace) { | 594 } catch (exception, stackTrace) { |
| 594 searchedPaths.add(librariesFile.path); | 595 searchedPaths.add(librariesFile.path); |
| 595 lastException = exception; | 596 lastException = exception; |
| 596 lastStackTrace = stackTrace; | 597 lastStackTrace = stackTrace; |
| 597 } | 598 } |
| 598 } | 599 } |
| 600 StringBuffer buffer = new StringBuffer(); |
| 601 buffer.writeln('Could not initialize the library map from $searchedPaths'); |
| 602 if (resourceProvider is MemoryResourceProvider) { |
| 603 (resourceProvider as MemoryResourceProvider).writeOn(buffer); |
| 604 } |
| 599 AnalysisEngine.instance.logger.logError( | 605 AnalysisEngine.instance.logger.logError( |
| 600 "Could not initialize the library map from $searchedPaths", | 606 buffer.toString(), new CaughtException(lastException, lastStackTrace)); |
| 601 new CaughtException(lastException, lastStackTrace)); | |
| 602 return new LibraryMap(); | 607 return new LibraryMap(); |
| 603 } | 608 } |
| 604 | 609 |
| 605 @override | 610 @override |
| 606 Source internalMapDartUri(String dartUri) { | 611 Source internalMapDartUri(String dartUri) { |
| 607 String libraryName; | 612 String libraryName; |
| 608 String relativePath; | 613 String relativePath; |
| 609 int index = dartUri.indexOf('/'); | 614 int index = dartUri.indexOf('/'); |
| 610 if (index >= 0) { | 615 if (index >= 0) { |
| 611 libraryName = dartUri.substring(0, index); | 616 libraryName = dartUri.substring(0, index); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 SdkLibrariesReader_LibraryBuilder libraryBuilder = | 849 SdkLibrariesReader_LibraryBuilder libraryBuilder = |
| 845 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); | 850 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); |
| 846 // If any syntactic errors were found then don't try to visit the AST | 851 // If any syntactic errors were found then don't try to visit the AST |
| 847 // structure. | 852 // structure. |
| 848 if (!errorListener.errorReported) { | 853 if (!errorListener.errorReported) { |
| 849 unit.accept(libraryBuilder); | 854 unit.accept(libraryBuilder); |
| 850 } | 855 } |
| 851 return libraryBuilder.librariesMap; | 856 return libraryBuilder.librariesMap; |
| 852 } | 857 } |
| 853 } | 858 } |
| OLD | NEW |