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

Side by Side Diff: tests/compiler/dart2js/inference/inference_test_helper.dart

Issue 3009043002: Handle variable declarations in inferrer (Closed)
Patch Set: Created 3 years, 3 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 | « tests/compiler/dart2js/inference/data/locals.dart ('k') | no next file » | 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'package:compiler/src/closure.dart'; 5 import 'package:compiler/src/closure.dart';
6 import 'package:compiler/src/common.dart'; 6 import 'package:compiler/src/common.dart';
7 import 'package:compiler/src/compiler.dart'; 7 import 'package:compiler/src/compiler.dart';
8 import 'package:compiler/src/diagnostics/diagnostic_listener.dart'; 8 import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
9 import 'package:compiler/src/elements/elements.dart'; 9 import 'package:compiler/src/elements/elements.dart';
10 import 'package:compiler/src/elements/entities.dart'; 10 import 'package:compiler/src/elements/entities.dart';
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 TypeMaskComputer(DiagnosticReporter reporter, Map<Id, ActualData> actualMap, 62 TypeMaskComputer(DiagnosticReporter reporter, Map<Id, ActualData> actualMap,
63 ResolvedAst resolvedAst, this.results) 63 ResolvedAst resolvedAst, this.results)
64 : result = results.resultOfMember(resolvedAst.element as MemberElement), 64 : result = results.resultOfMember(resolvedAst.element as MemberElement),
65 super(reporter, actualMap, resolvedAst); 65 super(reporter, actualMap, resolvedAst);
66 66
67 @override 67 @override
68 String computeElementValue(Id id, AstElement element) { 68 String computeElementValue(Id id, AstElement element) {
69 if (element.isParameter) { 69 if (element.isParameter) {
70 ParameterElement parameter = element; 70 ParameterElement parameter = element;
71 return getParameterValue(parameter); 71 return getParameterValue(parameter);
72 } else if (element.isLocal) { 72 } else if (element.isLocal && element.isFunction) {
73 LocalFunctionElement localFunction = element; 73 LocalFunctionElement localFunction = element;
74 return getMemberValue(localFunction.callMethod); 74 return getMemberValue(localFunction.callMethod);
75 } else { 75 } else {
76 MemberElement member = element; 76 MemberElement member = element;
77 return getMemberValue(member); 77 return getMemberValue(member);
78 } 78 }
79 } 79 }
80 80
81 @override 81 @override
82 String computeNodeValue(Id id, ast.Node node, [AstElement element]) { 82 String computeNodeValue(Id id, ast.Node node, [AstElement element]) {
83 if (node is ast.Send) { 83 if (element != null && element.isLocal && element.isFunction) {
84 return computeElementValue(id, element);
85 } else if (node is ast.SendSet) {
86 if (id.kind == IdKind.invoke) {
87 return getTypeMaskValue(result.typeOfOperator(node));
88 } else if (id.kind == IdKind.update) {
89 return getTypeMaskValue(result.typeOfSend(node));
90 } else if (id.kind == IdKind.node) {
91 return getTypeMaskValue(result.typeOfGetter(node));
92 }
93 } else if (node is ast.Send) {
84 return getTypeMaskValue(result.typeOfSend(node)); 94 return getTypeMaskValue(result.typeOfSend(node));
85 } else if (element != null && element.isLocal) {
86 return computeElementValue(id, element);
87 } 95 }
88 return null; 96 return null;
89 } 97 }
90 } 98 }
91 99
92 /// Compute type inference data for [member] from kernel based inference. 100 /// Compute type inference data for [member] from kernel based inference.
93 /// 101 ///
94 /// Fills [actualMap] with the data. 102 /// Fills [actualMap] with the data.
95 void computeMemberIrTypeMasks( 103 void computeMemberIrTypeMasks(
96 Compiler compiler, MemberEntity member, Map<Id, ActualData> actualMap, 104 Compiler compiler, MemberEntity member, Map<Id, ActualData> actualMap,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } else if (node is ir.FunctionExpression || 151 } else if (node is ir.FunctionExpression ||
144 node is ir.FunctionDeclaration) { 152 node is ir.FunctionDeclaration) {
145 ClosureRepresentationInfo info = _closureDataLookup.getClosureInfo(node); 153 ClosureRepresentationInfo info = _closureDataLookup.getClosureInfo(node);
146 return getMemberValue(info.callMethod); 154 return getMemberValue(info.callMethod);
147 } else if (node is ir.MethodInvocation) { 155 } else if (node is ir.MethodInvocation) {
148 return getTypeMaskValue(result.typeOfSend(node)); 156 return getTypeMaskValue(result.typeOfSend(node));
149 } 157 }
150 return null; 158 return null;
151 } 159 }
152 } 160 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/inference/data/locals.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698