| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 result.functions.add(info); | 313 result.functions.add(info); |
| 314 return info; | 314 return info; |
| 315 } | 315 } |
| 316 | 316 |
| 317 OutputUnitInfo _infoFromOutputUnit(OutputUnit outputUnit) { | 317 OutputUnitInfo _infoFromOutputUnit(OutputUnit outputUnit) { |
| 318 return _outputToInfo.putIfAbsent(outputUnit, () { | 318 return _outputToInfo.putIfAbsent(outputUnit, () { |
| 319 // Dump-info currently only works with the full emitter. If another | 319 // Dump-info currently only works with the full emitter. If another |
| 320 // emitter is used it will fail here. | 320 // emitter is used it will fail here. |
| 321 JavaScriptBackend backend = compiler.backend; | 321 JavaScriptBackend backend = compiler.backend; |
| 322 full.Emitter emitter = backend.emitter.emitter; | 322 full.Emitter emitter = backend.emitter.emitter; |
| 323 assert(outputUnit.name != null || outputUnit.isMainOutput); |
| 323 OutputUnitInfo info = new OutputUnitInfo( | 324 OutputUnitInfo info = new OutputUnitInfo( |
| 324 outputUnit.name, emitter.outputBuffers[outputUnit].length); | 325 outputUnit.name, emitter.outputBuffers[outputUnit].length); |
| 325 info.imports.addAll(outputUnit.imports | 326 info.imports.addAll(outputUnit.imports |
| 326 .map((d) => compiler.deferredLoadTask.importDeferName[d])); | 327 .map((d) => compiler.deferredLoadTask.importDeferName[d])); |
| 327 result.outputUnits.add(info); | 328 result.outputUnits.add(info); |
| 328 return info; | 329 return info; |
| 329 }); | 330 }); |
| 330 } | 331 } |
| 331 | 332 |
| 332 OutputUnitInfo _unitInfoForElement(Element element) { | 333 OutputUnitInfo _unitInfoForElement(Element element) { |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 | 586 |
| 586 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( | 587 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( |
| 587 new StringConversionSink.fromStringSink(buffer)); | 588 new StringConversionSink.fromStringSink(buffer)); |
| 588 sink.add(new AllInfoJsonCodec().encode(result)); | 589 sink.add(new AllInfoJsonCodec().encode(result)); |
| 589 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { | 590 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { |
| 590 'text': "View the dumped .info.json file at " | 591 'text': "View the dumped .info.json file at " |
| 591 "https://dart-lang.github.io/dump-info-visualizer" | 592 "https://dart-lang.github.io/dump-info-visualizer" |
| 592 }); | 593 }); |
| 593 } | 594 } |
| 594 } | 595 } |
| OLD | NEW |