| 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 @deprecated | 5 @deprecated |
| 6 library analyzer.source.embedder; | 6 library analyzer.source.embedder; |
| 7 | 7 |
| 8 import 'dart:collection' show HashMap; | 8 import 'dart:collection' show HashMap; |
| 9 import 'dart:core' hide Resource; | 9 import 'dart:core' hide Resource; |
| 10 | 10 |
| 11 import 'package:analyzer/file_system/file_system.dart'; | 11 import 'package:analyzer/file_system/file_system.dart'; |
| 12 import 'package:analyzer/source/package_map_provider.dart' | 12 import 'package:analyzer/source/package_map_provider.dart' |
| 13 show PackageMapProvider; | 13 show PackageMapProvider; |
| 14 import 'package:analyzer/src/generated/java_core.dart'; | |
| 15 import 'package:analyzer/src/generated/java_io.dart' show JavaFile; | 14 import 'package:analyzer/src/generated/java_io.dart' show JavaFile; |
| 16 import 'package:analyzer/src/generated/sdk.dart'; | 15 import 'package:analyzer/src/generated/sdk.dart'; |
| 17 import 'package:analyzer/src/generated/sdk_io.dart'; | 16 import 'package:analyzer/src/generated/sdk_io.dart'; |
| 18 import 'package:analyzer/src/generated/source.dart'; | 17 import 'package:analyzer/src/generated/source.dart'; |
| 19 import 'package:analyzer/src/generated/source_io.dart' show FileBasedSource; | 18 import 'package:analyzer/src/generated/source_io.dart' show FileBasedSource; |
| 20 import 'package:analyzer/src/summary/idl.dart' show PackageBundle; | 19 import 'package:analyzer/src/summary/idl.dart' show PackageBundle; |
| 21 import 'package:yaml/yaml.dart'; | 20 import 'package:yaml/yaml.dart'; |
| 22 | 21 |
| 23 export 'package:analyzer/src/context/builder.dart' show EmbedderYamlLocator; | 22 export 'package:analyzer/src/context/builder.dart' show EmbedderYamlLocator; |
| 24 | 23 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 if (index == -1) { | 80 if (index == -1) { |
| 82 return null; | 81 return null; |
| 83 } | 82 } |
| 84 } | 83 } |
| 85 String prefix = libraryPath.substring(0, index + 1); | 84 String prefix = libraryPath.substring(0, index + 1); |
| 86 srcPath = '$prefix$relativePath'; | 85 srcPath = '$prefix$relativePath'; |
| 87 } | 86 } |
| 88 String filePath = srcPath.replaceAll('/', JavaFile.separator); | 87 String filePath = srcPath.replaceAll('/', JavaFile.separator); |
| 89 try { | 88 try { |
| 90 JavaFile file = new JavaFile(filePath); | 89 JavaFile file = new JavaFile(filePath); |
| 91 return new FileBasedSource(file, parseUriWithException(dartUri)); | 90 return new FileBasedSource(file, Uri.parse(dartUri)); |
| 92 } on URISyntaxException { | 91 } on FormatException { |
| 93 return null; | 92 return null; |
| 94 } | 93 } |
| 95 } | 94 } |
| 96 | 95 |
| 97 /// Install the mapping from [name] to [libDir]/[file]. | 96 /// Install the mapping from [name] to [libDir]/[file]. |
| 98 void _processEmbeddedLibs(String name, String file, Folder libDir) { | 97 void _processEmbeddedLibs(String name, String file, Folder libDir) { |
| 99 if (!name.startsWith(_DART_COLON_PREFIX)) { | 98 if (!name.startsWith(_DART_COLON_PREFIX)) { |
| 100 // SDK libraries must begin with 'dart:'. | 99 // SDK libraries must begin with 'dart:'. |
| 101 return; | 100 return; |
| 102 } | 101 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 @override | 175 @override |
| 177 Uri restoreAbsolute(Source source) { | 176 Uri restoreAbsolute(Source source) { |
| 178 String path = source.fullName; | 177 String path = source.fullName; |
| 179 if (path.length > 3 && path[1] == ':' && path[2] == '\\') { | 178 if (path.length > 3 && path[1] == ':' && path[2] == '\\') { |
| 180 path = '/${path[0]}:${path.substring(2).replaceAll('\\', '/')}'; | 179 path = '/${path[0]}:${path.substring(2).replaceAll('\\', '/')}'; |
| 181 } | 180 } |
| 182 Source sdkSource = dartSdk.fromFileUri(Uri.parse('file://$path')); | 181 Source sdkSource = dartSdk.fromFileUri(Uri.parse('file://$path')); |
| 183 return sdkSource?.uri; | 182 return sdkSource?.uri; |
| 184 } | 183 } |
| 185 } | 184 } |
| OLD | NEW |