| 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 HtmlEscape, JsonEncoder, StringConversionSink, ChunkedConversionSink; | 8 show HtmlEscape, JsonEncoder, StringConversionSink, ChunkedConversionSink; |
| 9 | 9 |
| 10 import 'package:dart2js_info/info.dart'; | 10 import 'package:dart2js_info/info.dart'; |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 } | 319 } |
| 320 | 320 |
| 321 OutputUnitInfo _infoFromOutputUnit(OutputUnit outputUnit) { | 321 OutputUnitInfo _infoFromOutputUnit(OutputUnit outputUnit) { |
| 322 return _outputToInfo.putIfAbsent(outputUnit, () { | 322 return _outputToInfo.putIfAbsent(outputUnit, () { |
| 323 // Dump-info currently only works with the full emitter. If another | 323 // Dump-info currently only works with the full emitter. If another |
| 324 // emitter is used it will fail here. | 324 // emitter is used it will fail here. |
| 325 JavaScriptBackend backend = compiler.backend; | 325 JavaScriptBackend backend = compiler.backend; |
| 326 full.Emitter emitter = backend.emitter.emitter; | 326 full.Emitter emitter = backend.emitter.emitter; |
| 327 OutputUnitInfo info = new OutputUnitInfo( | 327 OutputUnitInfo info = new OutputUnitInfo( |
| 328 outputUnit.name, emitter.outputBuffers[outputUnit].length); | 328 outputUnit.name, emitter.outputBuffers[outputUnit].length); |
| 329 info.imports.addAll(outputUnit.imports |
| 330 .map((d) => compiler.deferredLoadTask.importDeferName[d])); |
| 329 result.outputUnits.add(info); | 331 result.outputUnits.add(info); |
| 330 return info; | 332 return info; |
| 331 }); | 333 }); |
| 332 } | 334 } |
| 333 | 335 |
| 334 OutputUnitInfo _unitInfoForElement(Element element) { | 336 OutputUnitInfo _unitInfoForElement(Element element) { |
| 335 return _infoFromOutputUnit( | 337 return _infoFromOutputUnit( |
| 336 compiler.deferredLoadTask.outputUnitForElement(element)); | 338 compiler.deferredLoadTask.outputUnitForElement(element)); |
| 337 } | 339 } |
| 338 | 340 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 | 573 |
| 572 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( | 574 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( |
| 573 new StringConversionSink.fromStringSink(buffer)); | 575 new StringConversionSink.fromStringSink(buffer)); |
| 574 sink.add(new AllInfoJsonCodec().encode(result)); | 576 sink.add(new AllInfoJsonCodec().encode(result)); |
| 575 reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { | 577 reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { |
| 576 'text': "View the dumped .info.json file at " | 578 'text': "View the dumped .info.json file at " |
| 577 "https://dart-lang.github.io/dump-info-visualizer" | 579 "https://dart-lang.github.io/dump-info-visualizer" |
| 578 }); | 580 }); |
| 579 } | 581 } |
| 580 } | 582 } |
| OLD | NEW |