| 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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 sb.writeln(jsAst.prettyPrint(ast, compiler.options)); | 536 sb.writeln(jsAst.prettyPrint(ast, compiler.options)); |
| 537 } | 537 } |
| 538 return sb.toString(); | 538 return sb.toString(); |
| 539 } | 539 } |
| 540 | 540 |
| 541 void dumpInfo(ClosedWorld closedWorld) { | 541 void dumpInfo(ClosedWorld closedWorld) { |
| 542 measure(() { | 542 measure(() { |
| 543 infoCollector = new ElementInfoCollector(compiler, closedWorld)..run(); | 543 infoCollector = new ElementInfoCollector(compiler, closedWorld)..run(); |
| 544 StringBuffer jsonBuffer = new StringBuffer(); | 544 StringBuffer jsonBuffer = new StringBuffer(); |
| 545 dumpInfoJson(jsonBuffer, closedWorld); | 545 dumpInfoJson(jsonBuffer, closedWorld); |
| 546 compiler.outputProvider(compiler.options.outputUri.pathSegments.last, | 546 compiler.outputProvider.createOutputSink( |
| 547 'info.json', OutputType.info) | 547 compiler.options.outputUri.pathSegments.last, |
| 548 'info.json', |
| 549 OutputType.info) |
| 548 ..add(jsonBuffer.toString()) | 550 ..add(jsonBuffer.toString()) |
| 549 ..close(); | 551 ..close(); |
| 550 }); | 552 }); |
| 551 } | 553 } |
| 552 | 554 |
| 553 void dumpInfoJson(StringSink buffer, ClosedWorld closedWorld) { | 555 void dumpInfoJson(StringSink buffer, ClosedWorld closedWorld) { |
| 554 JsonEncoder encoder = const JsonEncoder.withIndent(' '); | 556 JsonEncoder encoder = const JsonEncoder.withIndent(' '); |
| 555 Stopwatch stopwatch = new Stopwatch(); | 557 Stopwatch stopwatch = new Stopwatch(); |
| 556 stopwatch.start(); | 558 stopwatch.start(); |
| 557 | 559 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 | 620 |
| 619 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( | 621 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( |
| 620 new StringConversionSink.fromStringSink(buffer)); | 622 new StringConversionSink.fromStringSink(buffer)); |
| 621 sink.add(new AllInfoJsonCodec().encode(result)); | 623 sink.add(new AllInfoJsonCodec().encode(result)); |
| 622 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { | 624 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { |
| 623 'text': "View the dumped .info.json file at " | 625 'text': "View the dumped .info.json file at " |
| 624 "https://dart-lang.github.io/dump-info-visualizer" | 626 "https://dart-lang.github.io/dump-info-visualizer" |
| 625 }); | 627 }); |
| 626 } | 628 } |
| 627 } | 629 } |
| OLD | NEW |