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

Unified Diff: lib/src/emitters.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/directive_parser.dart ('k') | lib/src/files.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/emitters.dart
diff --git a/lib/src/emitters.dart b/lib/src/emitters.dart
index 0093f88e543aa1d7fd445b13befe3aabfb1d120f..19d252bbc86ac4a620c9e68bdea48203fd1fa5d2 100644
--- a/lib/src/emitters.dart
+++ b/lib/src/emitters.dart
@@ -351,7 +351,7 @@ class WebComponentEmitter extends RecursiveEmitter {
: info.tagName.replaceAll(new RegExp('[-./]'), '_');
printer.add(codegen.header(info.declaringFile.path, libraryName));
- // Add exisitng import, export, and part directives.
+ // Add existing import, export, and part directives.
for (var directive in codeInfo.directives) {
printer.add(codegen.directiveText(directive, info, pathInfo));
}
@@ -421,7 +421,7 @@ class MainPageEmitter extends RecursiveEmitter {
? codeInfo.libraryName : _fileInfo.libraryName;
printer.add(codegen.header(_fileInfo.path, libraryName));
- // Add exisitng import, export, and part directives.
+ // Add existing import, export, and part directives.
for (var directive in codeInfo.directives) {
printer.add(codegen.directiveText(directive, _fileInfo, pathInfo));
}
@@ -437,6 +437,23 @@ class MainPageEmitter extends RecursiveEmitter {
}
}
+/** Emits a .dart file using the [DartCodeInfo]. */
+String emitDartFile(FileInfo fileInfo, PathInfo pathInfo) {
+ var printer = new CodePrinter();
+
+ // Inject library name if not pressent.
+ var codeInfo = fileInfo.userCode;
+ var libraryName = codeInfo.libraryName;
+ printer.add(codegen.header(fileInfo.path, codeInfo.libraryName));
+
+ // Add existing import, export, and part directives.
+ for (var directive in codeInfo.directives) {
+ printer.add(codegen.directiveText(directive, fileInfo, pathInfo));
+ }
+ printer.addRaw(codeInfo.code);
+ return printer.formatString();
+}
+
/** Clears all fields in [declarations]. */
String _clearFields(Declarations declarations) {
if (declarations.declarations.isEmpty) return '';
« no previous file with comments | « lib/src/directive_parser.dart ('k') | lib/src/files.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698