| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 return _elementToInfo.putIfAbsent(element, () => visit(element)); | 75 return _elementToInfo.putIfAbsent(element, () => visit(element)); |
| 76 } | 76 } |
| 77 | 77 |
| 78 Info visitElement(Element element, _) => null; | 78 Info visitElement(Element element, _) => null; |
| 79 | 79 |
| 80 FunctionInfo visitConstructorBodyElement(ConstructorBodyElement e, _) { | 80 FunctionInfo visitConstructorBodyElement(ConstructorBodyElement e, _) { |
| 81 return visitFunctionElement(e.constructor, _); | 81 return visitFunctionElement(e.constructor, _); |
| 82 } | 82 } |
| 83 | 83 |
| 84 LibraryInfo visitLibraryElement(LibraryElement element, _) { | 84 LibraryInfo visitLibraryElement(LibraryElement element, _) { |
| 85 String libname = element.getLibraryName(); | 85 String libname = element.hasLibraryName ? element.libraryName : "<unnamed>"; |
| 86 libname = libname == "" ? "<unnamed>" : libname; | |
| 87 int size = compiler.dumpInfoTask.sizeOf(element); | 86 int size = compiler.dumpInfoTask.sizeOf(element); |
| 88 LibraryInfo info = | 87 LibraryInfo info = |
| 89 new LibraryInfo(libname, element.canonicalUri, null, size); | 88 new LibraryInfo(libname, element.canonicalUri, null, size); |
| 90 _elementToInfo[element] = info; | 89 _elementToInfo[element] = info; |
| 91 | 90 |
| 92 LibraryElement realElement = element.isPatched ? element.patch : element; | 91 LibraryElement realElement = element.isPatched ? element.patch : element; |
| 93 realElement.forEachLocalMember((Element member) { | 92 realElement.forEachLocalMember((Element member) { |
| 94 Info child = this.process(member); | 93 Info child = this.process(member); |
| 95 if (child is ClassInfo) { | 94 if (child is ClassInfo) { |
| 96 info.classes.add(child); | 95 info.classes.add(child); |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 | 561 |
| 563 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( | 562 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( |
| 564 new StringConversionSink.fromStringSink(buffer)); | 563 new StringConversionSink.fromStringSink(buffer)); |
| 565 sink.add(result.toJson()); | 564 sink.add(result.toJson()); |
| 566 compiler.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { | 565 compiler.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { |
| 567 'text': "View the dumped .info.json file at " | 566 'text': "View the dumped .info.json file at " |
| 568 "https://dart-lang.github.io/dump-info-visualizer" | 567 "https://dart-lang.github.io/dump-info-visualizer" |
| 569 }); | 568 }); |
| 570 } | 569 } |
| 571 } | 570 } |
| OLD | NEW |