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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 return info; | 119 return info; |
120 } | 120 } |
121 | 121 |
122 _resultOfMember(MemberElement e) => | 122 _resultOfMember(MemberElement e) => |
123 compiler.globalInference.results.resultOfMember(e); | 123 compiler.globalInference.results.resultOfMember(e); |
124 | 124 |
125 _resultOfParameter(ParameterElement e) => | 125 _resultOfParameter(ParameterElement e) => |
126 compiler.globalInference.results.resultOfParameter(e); | 126 compiler.globalInference.results.resultOfParameter(e); |
127 | 127 |
128 FieldInfo visitFieldElement(FieldElement element, _) { | 128 FieldInfo visitFieldElement(FieldElement element, _) { |
129 if (!compiler.resolution.hasBeenResolved(element)) return null; | |
Johnni Winther
2017/07/04 13:46:24
This would trigger a 'type has not been compute' f
Siggi Cherem (dart-lang)
2017/07/05 21:04:14
do you mean we are hitting this issue on programs
Johnni Winther
2017/07/06 09:38:14
No. The visiting just eagerly runs through all fie
| |
129 TypeMask inferredType = _resultOfMember(element).type; | 130 TypeMask inferredType = _resultOfMember(element).type; |
130 // If a field has an empty inferred type it is never used. | 131 // If a field has an empty inferred type it is never used. |
131 if (inferredType == null || inferredType.isEmpty) return null; | 132 if (inferredType == null || inferredType.isEmpty) return null; |
132 | 133 |
133 int size = compiler.dumpInfoTask.sizeOf(element); | 134 int size = compiler.dumpInfoTask.sizeOf(element); |
134 String code = compiler.dumpInfoTask.codeOf(element); | 135 String code = compiler.dumpInfoTask.codeOf(element); |
135 if (code != null) size += code.length; | 136 if (code != null) size += code.length; |
136 | 137 |
137 FieldInfo info = new FieldInfo( | 138 FieldInfo info = new FieldInfo( |
138 name: element.name, | 139 name: element.name, |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
617 | 618 |
618 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( | 619 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( |
619 new StringConversionSink.fromStringSink(buffer)); | 620 new StringConversionSink.fromStringSink(buffer)); |
620 sink.add(new AllInfoJsonCodec().encode(result)); | 621 sink.add(new AllInfoJsonCodec().encode(result)); |
621 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { | 622 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { |
622 'text': "View the dumped .info.json file at " | 623 'text': "View the dumped .info.json file at " |
623 "https://dart-lang.github.io/dump-info-visualizer" | 624 "https://dart-lang.github.io/dump-info-visualizer" |
624 }); | 625 }); |
625 } | 626 } |
626 } | 627 } |
OLD | NEW |