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

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

Issue 2836483002: Snapshot DDC trained on itself (Closed)
Patch Set: Fix paths 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 | utils/dartdevc/BUILD.gn » ('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 5866870795b4c6b7889adaf99ac693c3d05011d2..9843eb0b3be33f42817b135b573bae128b498e44 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 relative, separator;
+import 'package:path/path.dart' show isWithin, relative, separator;
import '../closure/closure_annotator.dart' show ClosureAnnotator;
import '../js_ast/js_ast.dart' as JS;
@@ -6032,7 +6032,7 @@ String jsLibraryName(String libraryRoot, LibraryElement library) {
// 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(encodedSeparator);
- } else if (uri.toFilePath().startsWith(libraryRoot)) {
+ } else if (isWithin(libraryRoot, uri.toFilePath())) {
qualifiedPath = uri.path
.substring(libraryRoot.length)
.replaceAll(separator, encodedSeparator);
@@ -6051,7 +6051,7 @@ String jsLibraryDebuggerName(String libraryRoot, LibraryElement library) {
if (uri.scheme == 'dart' || uri.scheme == 'package') return uri.toString();
var filePath = uri.toFilePath();
- if (!filePath.startsWith(libraryRoot)) {
+ if (!isWithin(libraryRoot, filePath)) {
throw 'Invalid library root. $libraryRoot does not contain ${uri
.toFilePath()}';
}
« no previous file with comments | « no previous file | utils/dartdevc/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698