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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 coverageId: '${element.hashCode}', | 132 coverageId: '${element.hashCode}', |
133 type: '${element.type}', | 133 type: '${element.type}', |
134 inferredType: '$inferredType', | 134 inferredType: '$inferredType', |
135 size: size, | 135 size: size, |
136 code: code, | 136 code: code, |
137 outputUnit: _unitInfoForElement(element), | 137 outputUnit: _unitInfoForElement(element), |
138 isConst: element.isConst); | 138 isConst: element.isConst); |
139 _elementToInfo[element] = info; | 139 _elementToInfo[element] = info; |
140 if (element.isConst) { | 140 if (element.isConst) { |
141 var value = compiler.backend.constantCompilerTask | 141 var value = compiler.backend.constantCompilerTask |
142 .getConstantValueForVariable(element); | 142 .getConstantValue(element.constant); |
143 if (value != null) { | 143 if (value != null) { |
144 info.initializer = _constantToInfo[value]; | 144 info.initializer = _constantToInfo[value]; |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 List<FunctionInfo> nestedClosures = <FunctionInfo>[]; | 148 List<FunctionInfo> nestedClosures = <FunctionInfo>[]; |
149 for (Element closure in element.nestedClosures) { | 149 for (Element closure in element.nestedClosures) { |
150 Info child = this.process(closure); | 150 Info child = this.process(closure); |
151 if (child != null) { | 151 if (child != null) { |
152 ClassInfo parent = this.process(closure.enclosingElement); | 152 ClassInfo parent = this.process(closure.enclosingElement); |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 587 |
588 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( | 588 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( |
589 new StringConversionSink.fromStringSink(buffer)); | 589 new StringConversionSink.fromStringSink(buffer)); |
590 sink.add(new AllInfoJsonCodec().encode(result)); | 590 sink.add(new AllInfoJsonCodec().encode(result)); |
591 reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { | 591 reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { |
592 'text': "View the dumped .info.json file at " | 592 'text': "View the dumped .info.json file at " |
593 "https://dart-lang.github.io/dump-info-visualizer" | 593 "https://dart-lang.github.io/dump-info-visualizer" |
594 }); | 594 }); |
595 } | 595 } |
596 } | 596 } |
OLD | NEW |