| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dump_info; | 5 library dump_info; |
| 6 | 6 |
| 7 import 'dart:convert' | 7 import 'dart:convert' |
| 8 show ChunkedConversionSink, JsonEncoder, StringConversionSink; | 8 show ChunkedConversionSink, JsonEncoder, StringConversionSink; |
| 9 | 9 |
| 10 import 'package:dart2js_info/info.dart'; | 10 import 'package:dart2js_info/info.dart'; |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 } | 342 } |
| 343 | 343 |
| 344 OutputUnitInfo _infoFromOutputUnit(OutputUnit outputUnit) { | 344 OutputUnitInfo _infoFromOutputUnit(OutputUnit outputUnit) { |
| 345 return _outputToInfo.putIfAbsent(outputUnit, () { | 345 return _outputToInfo.putIfAbsent(outputUnit, () { |
| 346 // Dump-info currently only works with the full emitter. If another | 346 // Dump-info currently only works with the full emitter. If another |
| 347 // emitter is used it will fail here. | 347 // emitter is used it will fail here. |
| 348 JavaScriptBackend backend = compiler.backend; | 348 JavaScriptBackend backend = compiler.backend; |
| 349 assert(outputUnit.name != null || outputUnit.isMainOutput); | 349 assert(outputUnit.name != null || outputUnit.isMainOutput); |
| 350 OutputUnitInfo info = new OutputUnitInfo( | 350 OutputUnitInfo info = new OutputUnitInfo( |
| 351 outputUnit.name, backend.emitter.emitter.generatedSize(outputUnit)); | 351 outputUnit.name, backend.emitter.emitter.generatedSize(outputUnit)); |
| 352 info.imports.addAll(outputUnit.imports | 352 info.imports.addAll(compiler.deferredLoadTask.getImportNames(outputUnit)); |
| 353 .map((d) => compiler.deferredLoadTask.importDeferName[d])); | |
| 354 result.outputUnits.add(info); | 353 result.outputUnits.add(info); |
| 355 return info; | 354 return info; |
| 356 }); | 355 }); |
| 357 } | 356 } |
| 358 | 357 |
| 359 OutputUnitInfo _unitInfoForElement(Element element) { | 358 OutputUnitInfo _unitInfoForElement(Element element) { |
| 360 return _infoFromOutputUnit( | 359 return _infoFromOutputUnit( |
| 361 compiler.deferredLoadTask.outputUnitForElement(element)); | 360 compiler.deferredLoadTask.outputUnitForElement(element)); |
| 362 } | 361 } |
| 363 | 362 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 | 618 |
| 620 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( | 619 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( |
| 621 new StringConversionSink.fromStringSink(buffer)); | 620 new StringConversionSink.fromStringSink(buffer)); |
| 622 sink.add(new AllInfoJsonCodec().encode(result)); | 621 sink.add(new AllInfoJsonCodec().encode(result)); |
| 623 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { | 622 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { |
| 624 'text': "View the dumped .info.json file at " | 623 'text': "View the dumped .info.json file at " |
| 625 "https://dart-lang.github.io/dump-info-visualizer" | 624 "https://dart-lang.github.io/dump-info-visualizer" |
| 626 }); | 625 }); |
| 627 } | 626 } |
| 628 } | 627 } |
| OLD | NEW |