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

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

Issue 2415653002: Fix library name insert and access inconsistency on windows (Closed)
Patch Set: Created 4 years, 2 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 | no next file » | 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 9cbc9ec0944963f19f5db971f50c5027fa1cbfb1..6cc873085de59bfb706dd49027afe90186225141 100644
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
@@ -31,7 +31,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 separator, isWithin, fromUri;
import '../closure/closure_annotator.dart' show ClosureAnnotator;
import '../js_ast/js_ast.dart' as JS;
@@ -5452,16 +5452,16 @@ 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 customSeparator = '__';
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);
- } else if (uri.toFilePath().startsWith(libraryRoot)) {
+ qualifiedPath = uri.pathSegments.skip(1).join(customSeparator);
+ } else if (isWithin(libraryRoot, uri.toFilePath())) {
qualifiedPath =
- uri.path.substring(libraryRoot.length).replaceAll('/', separator);
+ fromUri(uri).substring(libraryRoot.length).replaceAll(separator, customSeparator);
vsm 2016/10/12 20:32:05 Can you run ./tool/format.sh ? It should fix the
} else {
// We don't have a unique name.
throw 'Invalid library root. $libraryRoot does not contain ${uri
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698