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

Unified Diff: lib/src/codegen.dart

Issue 12096106: work in progress: observable implementation using detailed change records (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: Created 7 years, 11 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 | « lib/src/analyzer.dart ('k') | lib/src/compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/codegen.dart
diff --git a/lib/src/codegen.dart b/lib/src/codegen.dart
index baffd1b6fd5104d0c2a33d3de8084da493f9917e..0cd6163c1c42c30de3baf6f896ee283f1679ff01 100644
--- a/lib/src/codegen.dart
+++ b/lib/src/codegen.dart
@@ -14,14 +14,15 @@ import 'utils.dart';
* null then there is no file associated with the template (used by testing
* so we'll display <MEMORY> for file name.
*/
-String header(Path path, String libraryName) => """
+String header(Path path, String libraryName) {
+ var library = libraryName != null ? '\nlibrary $libraryName;\n' : '';
+ return """
// Auto-generated from ${path != null ? path.filename : "<MEMORY>"}.
// DO NOT EDIT.
-
-library $libraryName;
-
+$library
$imports
""";
+}
// TODO(sigmund): include only those imports that are used by the code.
String get imports => """
@@ -128,7 +129,11 @@ String importList(Iterable<Path> imports) =>
String directiveText(
DartDirectiveInfo directive, LibraryInfo src, PathInfo pathInfo) {
var buff = new StringBuffer();
- var uri = pathInfo.transformUrl(src.inputPath, directive.uri);
+ var uri = directive.uri;
+ if (!directive.generated) {
+ // This file was not generated, so get the relative path to the input file.
+ uri = pathInfo.transformUrl(src.inputPath, uri);
+ }
buff..add(directive.label)
..add(" '")
..add(uri.replaceAll("'", "\\'"))
« no previous file with comments | « lib/src/analyzer.dart ('k') | lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698