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

Side by Side Diff: lib/src/codegen/js_printer.dart

Issue 1676463002: Type annotations instead of closure comments. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merged master Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « lib/src/codegen/js_names.dart ('k') | lib/src/codegen/js_typeref_codegen.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:convert' show JSON, JsonEncoder; 5 import 'dart:convert' show JSON, JsonEncoder;
6 import 'dart:io' show Directory, File, Platform, Process; 6 import 'dart:io' show Directory, File, Platform, Process;
7 7
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:path/path.dart' as path; 9 import 'package:path/path.dart' as path;
10 import 'package:source_maps/source_maps.dart' as srcmaps show Printer; 10 import 'package:source_maps/source_maps.dart' as srcmaps show Printer;
(...skipping 14 matching lines...) Expand all
25 JS.JavaScriptPrintingContext context; 25 JS.JavaScriptPrintingContext context;
26 if (emitSourceMaps) { 26 if (emitSourceMaps) {
27 var printer = new srcmaps.Printer(outFilename); 27 var printer = new srcmaps.Printer(outFilename);
28 context = 28 context =
29 new SourceMapPrintingContext(printer, outDir, inputDir, serverUri); 29 new SourceMapPrintingContext(printer, outDir, inputDir, serverUri);
30 } else { 30 } else {
31 context = new JS.SimpleJavaScriptPrintingContext(); 31 context = new JS.SimpleJavaScriptPrintingContext();
32 } 32 }
33 33
34 var opts = new JS.JavaScriptPrintingOptions( 34 var opts = new JS.JavaScriptPrintingOptions(
35 allowKeywordsInProperties: true, allowSingleLineIfStatements: true); 35 shouldEmitTypes: true,
36 allowKeywordsInProperties: true,
37 allowSingleLineIfStatements: true);
36 var jsNamer = new TemporaryNamer(jsTree); 38 var jsNamer = new TemporaryNamer(jsTree);
37 jsTree.accept(new JS.Printer(opts, context, localNamer: jsNamer)); 39 jsTree.accept(new JS.Printer(opts, context, localNamer: jsNamer));
38 40
39 String text; 41 String text;
40 if (context is SourceMapPrintingContext) { 42 if (context is SourceMapPrintingContext) {
41 var printer = context.printer; 43 var printer = context.printer;
42 printer.add('//# sourceMappingURL=$outFilename.map\n'); 44 printer.add('//# sourceMappingURL=$outFilename.map\n');
43 // Write output file and source map 45 // Write output file and source map
44 text = printer.text; 46 text = printer.text;
45 var sourceMap = JSON.decode(printer.map); 47 var sourceMap = JSON.decode(printer.map);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 _currentTopLevelDeclaration == null; 144 _currentTopLevelDeclaration == null;
143 return; 145 return;
144 } 146 }
145 } 147 }
146 148
147 String _getIdentifier(AstNode node) { 149 String _getIdentifier(AstNode node) {
148 if (node is SimpleIdentifier) return node.name; 150 if (node is SimpleIdentifier) return node.name;
149 return null; 151 return null;
150 } 152 }
151 } 153 }
OLDNEW
« no previous file with comments | « lib/src/codegen/js_names.dart ('k') | lib/src/codegen/js_typeref_codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698