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

Unified Diff: pkg/dev_compiler/lib/src/compiler/code_generator.dart

Issue 2833633002: Various DDC fixes for windows (Closed)
Patch Set: Fix formatting Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/dev_compiler/lib/src/compiler/compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/lib/src/compiler/code_generator.dart
diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
index e24dce52e3e059d672b4e0ddcc8c594df115cef4..b1e665ae2838b7eaebe48d2b31dfeb9711d92d97 100644
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
@@ -33,7 +33,7 @@ import 'package:analyzer/src/summary/summarize_elements.dart'
import 'package:analyzer/src/summary/summary_sdk.dart';
import 'package:analyzer/src/task/strong/ast_properties.dart'
show isDynamicInvoke, setIsDynamicInvoke, getImplicitAssignmentCast;
-import 'package:path/path.dart' show separator;
+import 'package:path/path.dart' show relative, separator;
import '../closure/closure_annotator.dart' show ClosureAnnotator;
import '../js_ast/js_ast.dart' as JS;
@@ -6017,16 +6017,17 @@ String jsLibraryName(String libraryRoot, LibraryElement library) {
return uri.path;
}
// TODO(vsm): This is not necessarily unique if '__' appears in a file name.
- var separator = '__';
+ var encodedSeparator = '__';
String qualifiedPath;
if (uri.scheme == 'package') {
// Strip the package name.
// TODO(vsm): This is not unique if an escaped '/'appears in a filename.
// E.g., "foo/bar.dart" and "foo$47bar.dart" would collide.
- qualifiedPath = uri.pathSegments.skip(1).join(separator);
+ qualifiedPath = uri.pathSegments.skip(1).join(encodedSeparator);
} else if (uri.toFilePath().startsWith(libraryRoot)) {
- qualifiedPath =
- uri.path.substring(libraryRoot.length).replaceAll('/', separator);
+ qualifiedPath = uri.path
+ .substring(libraryRoot.length)
+ .replaceAll(separator, encodedSeparator);
} else {
// We don't have a unique name.
throw 'Invalid library root. $libraryRoot does not contain ${uri
@@ -6041,12 +6042,13 @@ String jsLibraryDebuggerName(String libraryRoot, LibraryElement library) {
// For package: and dart: uris show the entire
if (uri.scheme == 'dart' || uri.scheme == 'package') return uri.toString();
- if (!uri.toFilePath().startsWith(libraryRoot)) {
+ var filePath = uri.toFilePath();
+ if (!filePath.startsWith(libraryRoot)) {
throw 'Invalid library root. $libraryRoot does not contain ${uri
.toFilePath()}';
}
// Relative path to the library.
- return uri.path.substring(libraryRoot.length);
+ return relative(filePath, from: libraryRoot);
}
String jsDebuggingLibraryName(String libraryRoot, LibraryElement library) {
« no previous file with comments | « no previous file | pkg/dev_compiler/lib/src/compiler/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698