| 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 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 Renamer renamerForNames: JavaScriptPrintingOptions.identityRenamer}) { | 37 Renamer renamerForNames: JavaScriptPrintingOptions.identityRenamer}) { |
| 38 JavaScriptSourceInformationStrategy sourceInformationFactory = | 38 JavaScriptSourceInformationStrategy sourceInformationFactory = |
| 39 compiler.backend.sourceInformationStrategy; | 39 compiler.backend.sourceInformationStrategy; |
| 40 JavaScriptPrintingOptions options = new JavaScriptPrintingOptions( | 40 JavaScriptPrintingOptions options = new JavaScriptPrintingOptions( |
| 41 shouldCompressOutput: compiler.options.enableMinification, | 41 shouldCompressOutput: compiler.options.enableMinification, |
| 42 minifyLocalVariables: allowVariableMinification, | 42 minifyLocalVariables: allowVariableMinification, |
| 43 preferSemicolonToNewlineInMinifiedOutput: USE_LAZY_EMITTER, | 43 preferSemicolonToNewlineInMinifiedOutput: USE_LAZY_EMITTER, |
| 44 renamerForNames: renamerForNames); | 44 renamerForNames: renamerForNames); |
| 45 CodeBuffer outBuffer = new CodeBuffer(); | 45 CodeBuffer outBuffer = new CodeBuffer(); |
| 46 SourceInformationProcessor sourceInformationProcessor = | 46 SourceInformationProcessor sourceInformationProcessor = |
| 47 sourceInformationFactory | 47 sourceInformationFactory.createProcessor( |
| 48 .createProcessor(new SourceLocationsMapper(outBuffer)); | 48 new SourceMapperProviderImpl(outBuffer), |
| 49 const SourceInformationReader()); |
| 49 Dart2JSJavaScriptPrintingContext context = | 50 Dart2JSJavaScriptPrintingContext context = |
| 50 new Dart2JSJavaScriptPrintingContext( | 51 new Dart2JSJavaScriptPrintingContext( |
| 51 compiler.reporter, monitor, outBuffer, sourceInformationProcessor); | 52 compiler.reporter, monitor, outBuffer, sourceInformationProcessor); |
| 52 Printer printer = new Printer(options, context); | 53 Printer printer = new Printer(options, context); |
| 53 printer.visit(node); | 54 printer.visit(node); |
| 54 sourceInformationProcessor.process(node, outBuffer); | 55 sourceInformationProcessor.process(node, outBuffer); |
| 55 return outBuffer; | 56 return outBuffer; |
| 56 } | 57 } |
| 57 | 58 |
| 58 class Dart2JSJavaScriptPrintingContext implements JavaScriptPrintingContext { | 59 class Dart2JSJavaScriptPrintingContext implements JavaScriptPrintingContext { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 189 } |
| 189 if (node is PropertyAccess) { | 190 if (node is PropertyAccess) { |
| 190 PropertyAccess access = node; | 191 PropertyAccess access = node; |
| 191 if (access.receiver is InterpolatedExpression) { | 192 if (access.receiver is InterpolatedExpression) { |
| 192 InterpolatedExpression hole = access.receiver; | 193 InterpolatedExpression hole = access.receiver; |
| 193 return hole.isPositional && hole.nameOrPosition == 0; | 194 return hole.isPositional && hole.nameOrPosition == 0; |
| 194 } | 195 } |
| 195 } | 196 } |
| 196 return false; | 197 return false; |
| 197 } | 198 } |
| OLD | NEW |