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