| OLD | NEW |
| 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 library js; | 5 library js; |
| 6 | 6 |
| 7 import 'package:js_ast/js_ast.dart'; | 7 import 'package:js_ast/js_ast.dart'; |
| 8 export 'package:js_ast/js_ast.dart'; | 8 export 'package:js_ast/js_ast.dart'; |
| 9 | 9 |
| 10 import '../io/code_output.dart' show CodeOutput, CodeBuffer; | 10 import '../io/code_output.dart' show CodeOutput, CodeBuffer; |
| 11 import '../js_emitter/js_emitter.dart' show USE_NEW_EMITTER; | 11 import '../js_emitter/js_emitter.dart' show USE_LAZY_EMITTER; |
| 12 import '../dart2jslib.dart' as leg; | 12 import '../dart2jslib.dart' as leg; |
| 13 import '../util/util.dart' show NO_LOCATION_SPANNABLE, Indentation, Tagging; | 13 import '../util/util.dart' show NO_LOCATION_SPANNABLE, Indentation, Tagging; |
| 14 import '../dump_info.dart' show DumpInfoTask; | 14 import '../dump_info.dart' show DumpInfoTask; |
| 15 import 'js_source_mapping.dart'; | 15 import 'js_source_mapping.dart'; |
| 16 | 16 |
| 17 CodeBuffer prettyPrint(Node node, | 17 CodeBuffer prettyPrint(Node node, |
| 18 leg.Compiler compiler, | 18 leg.Compiler compiler, |
| 19 {DumpInfoTask monitor, | 19 {DumpInfoTask monitor, |
| 20 bool allowVariableMinification: true, | 20 bool allowVariableMinification: true, |
| 21 Renamer renamerForNames: | 21 Renamer renamerForNames: |
| 22 JavaScriptPrintingOptions.identityRenamer}) { | 22 JavaScriptPrintingOptions.identityRenamer}) { |
| 23 JavaScriptSourceInformationStrategy sourceInformationFactory = | 23 JavaScriptSourceInformationStrategy sourceInformationFactory = |
| 24 compiler.backend.sourceInformationStrategy; | 24 compiler.backend.sourceInformationStrategy; |
| 25 JavaScriptPrintingOptions options = new JavaScriptPrintingOptions( | 25 JavaScriptPrintingOptions options = new JavaScriptPrintingOptions( |
| 26 shouldCompressOutput: compiler.enableMinification, | 26 shouldCompressOutput: compiler.enableMinification, |
| 27 minifyLocalVariables: allowVariableMinification, | 27 minifyLocalVariables: allowVariableMinification, |
| 28 preferSemicolonToNewlineInMinifiedOutput: USE_NEW_EMITTER, | 28 preferSemicolonToNewlineInMinifiedOutput: USE_LAZY_EMITTER, |
| 29 renamerForNames: renamerForNames); | 29 renamerForNames: renamerForNames); |
| 30 CodeBuffer outBuffer = new CodeBuffer(); | 30 CodeBuffer outBuffer = new CodeBuffer(); |
| 31 SourceInformationProcessor sourceInformationProcessor = | 31 SourceInformationProcessor sourceInformationProcessor = |
| 32 sourceInformationFactory.createProcessor( | 32 sourceInformationFactory.createProcessor( |
| 33 new SourceLocationsMapper(outBuffer)); | 33 new SourceLocationsMapper(outBuffer)); |
| 34 Dart2JSJavaScriptPrintingContext context = | 34 Dart2JSJavaScriptPrintingContext context = |
| 35 new Dart2JSJavaScriptPrintingContext( | 35 new Dart2JSJavaScriptPrintingContext( |
| 36 compiler, monitor, outBuffer, sourceInformationProcessor); | 36 compiler, monitor, outBuffer, sourceInformationProcessor); |
| 37 Printer printer = new Printer(options, context); | 37 Printer printer = new Printer(options, context); |
| 38 printer.visit(node); | 38 printer.visit(node); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 _cachedLiteral = js.escapedString(text); | 152 _cachedLiteral = js.escapedString(text); |
| 153 } | 153 } |
| 154 return _cachedLiteral; | 154 return _cachedLiteral; |
| 155 } | 155 } |
| 156 | 156 |
| 157 @override | 157 @override |
| 158 String get value => _literal.value; | 158 String get value => _literal.value; |
| 159 } | 159 } |
| OLD | NEW |