Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(939)

Side by Side Diff: pkg/compiler/lib/src/dump_info.dart

Issue 2777093010: Use entities in NoSuchMethodRegistry (Closed)
Patch Set: Move as cast. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/type_graph_nodes.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 TypedefInfo visitTypedefElement(TypedefElement element, _) { 112 TypedefInfo visitTypedefElement(TypedefElement element, _) {
113 if (!element.isResolved) return null; 113 if (!element.isResolved) return null;
114 TypedefInfo info = new TypedefInfo( 114 TypedefInfo info = new TypedefInfo(
115 element.name, '${element.alias}', _unitInfoForElement(element)); 115 element.name, '${element.alias}', _unitInfoForElement(element));
116 _elementToInfo[element] = info; 116 _elementToInfo[element] = info;
117 result.typedefs.add(info); 117 result.typedefs.add(info);
118 return info; 118 return info;
119 } 119 }
120 120
121 _resultOf(e) => compiler.globalInference.results.resultOf(e); 121 _resultOfMember(MemberElement e) =>
122 compiler.globalInference.results.resultOfMember(e);
123
124 _resultOfParameter(ParameterElement e) =>
125 compiler.globalInference.results.resultOfParameter(e);
126
127 @deprecated
128 _resultOfElement(AstElement e) =>
129 compiler.globalInference.results.resultOfElement(e);
122 130
123 FieldInfo visitFieldElement(FieldElement element, _) { 131 FieldInfo visitFieldElement(FieldElement element, _) {
124 TypeMask inferredType = _resultOf(element).type; 132 TypeMask inferredType = _resultOfMember(element).type;
125 // If a field has an empty inferred type it is never used. 133 // If a field has an empty inferred type it is never used.
126 if (inferredType == null || inferredType.isEmpty) return null; 134 if (inferredType == null || inferredType.isEmpty) return null;
127 135
128 int size = compiler.dumpInfoTask.sizeOf(element); 136 int size = compiler.dumpInfoTask.sizeOf(element);
129 String code = compiler.dumpInfoTask.codeOf(element); 137 String code = compiler.dumpInfoTask.codeOf(element);
130 if (code != null) size += code.length; 138 if (code != null) size += code.length;
131 139
132 FieldInfo info = new FieldInfo( 140 FieldInfo info = new FieldInfo(
133 name: element.name, 141 name: element.name,
134 type: '${element.type}', 142 type: '${element.type}',
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 isConst: element.isConst, 259 isConst: element.isConst,
252 isFactory: element.isFactoryConstructor, 260 isFactory: element.isFactoryConstructor,
253 isExternal: element.isPatched); 261 isExternal: element.isPatched);
254 String code = compiler.dumpInfoTask.codeOf(element); 262 String code = compiler.dumpInfoTask.codeOf(element);
255 263
256 List<ParameterInfo> parameters = <ParameterInfo>[]; 264 List<ParameterInfo> parameters = <ParameterInfo>[];
257 if (element.hasFunctionSignature) { 265 if (element.hasFunctionSignature) {
258 FunctionSignature signature = element.functionSignature; 266 FunctionSignature signature = element.functionSignature;
259 signature.forEachParameter((parameter) { 267 signature.forEachParameter((parameter) {
260 parameters.add(new ParameterInfo(parameter.name, 268 parameters.add(new ParameterInfo(parameter.name,
261 '${_resultOf(parameter).type}', '${parameter.node.type}')); 269 '${_resultOfParameter(parameter).type}', '${parameter.node.type}'));
262 }); 270 });
263 } 271 }
264 272
265 String returnType = null; 273 String returnType = null;
266 // TODO(sigmund): why all these checks? 274 // TODO(sigmund): why all these checks?
267 if (element.isInstanceMember && 275 if (element.isInstanceMember &&
268 !element.isAbstract && 276 !element.isAbstract &&
269 closedWorld.allFunctions.contains(element as MemberElement)) { 277 closedWorld.allFunctions.contains(element as MemberElement)) {
270 returnType = '${element.type.returnType}'; 278 returnType = '${element.type.returnType}';
271 } 279 }
272 String inferredReturnType = '${_resultOf(element).returnType}'; 280 String inferredReturnType = '${_resultOfElement(element).returnType}';
273 String sideEffects = '${closedWorld.getSideEffectsOfElement(element)}'; 281 String sideEffects = '${closedWorld.getSideEffectsOfElement(element)}';
274 282
275 int inlinedCount = compiler.dumpInfoTask.inlineCount[element]; 283 int inlinedCount = compiler.dumpInfoTask.inlineCount[element];
276 if (inlinedCount == null) inlinedCount = 0; 284 if (inlinedCount == null) inlinedCount = 0;
277 285
278 FunctionInfo info = new FunctionInfo( 286 FunctionInfo info = new FunctionInfo(
279 name: name, 287 name: name,
280 functionKind: kind, 288 functionKind: kind,
281 modifiers: modifiers, 289 modifiers: modifiers,
282 returnType: returnType, 290 returnType: returnType,
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 616
609 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( 617 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
610 new StringConversionSink.fromStringSink(buffer)); 618 new StringConversionSink.fromStringSink(buffer));
611 sink.add(new AllInfoJsonCodec().encode(result)); 619 sink.add(new AllInfoJsonCodec().encode(result));
612 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { 620 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, {
613 'text': "View the dumped .info.json file at " 621 'text': "View the dumped .info.json file at "
614 "https://dart-lang.github.io/dump-info-visualizer" 622 "https://dart-lang.github.io/dump-info-visualizer"
615 }); 623 });
616 } 624 }
617 } 625 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/type_graph_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698