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

Side by Side Diff: pkg/compiler/lib/src/inferrer/builder_kernel.dart

Issue 3008083002: Handle variable set 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 | « no previous file | tests/compiler/dart2js/inference/data/locals.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) 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:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../closure.dart'; 7 import '../closure.dart';
8 import '../common.dart'; 8 import '../common.dart';
9 import '../constants/constant_system.dart'; 9 import '../constants/constant_system.dart';
10 import '../elements/entities.dart'; 10 import '../elements/entities.dart';
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 break; 142 break;
143 case ir.AsyncMarker.SyncYielding: 143 case ir.AsyncMarker.SyncYielding:
144 failedAt( 144 failedAt(
145 _analyzedMember, "Unexpected async marker: ${node.asyncMarker}"); 145 _analyzedMember, "Unexpected async marker: ${node.asyncMarker}");
146 break; 146 break;
147 } 147 }
148 return _returnType; 148 return _returnType;
149 } 149 }
150 150
151 @override 151 @override
152 TypeInformation defaultExpression(ir.Expression expression) { 152 TypeInformation defaultExpression(ir.Expression node) {
153 // TODO(efortuna): Remove when more is implemented. 153 // TODO(johnniwinther): Make this throw to assert that all expressions are
154 // handled.
154 return _types.dynamicType; 155 return _types.dynamicType;
155 } 156 }
156 157
157 @override 158 @override
159 TypeInformation defaultStatement(ir.Statement node) {
160 // TODO(johnniwinther): Make this throw to assert that all statements are
161 // handled.
162 node.visitChildren(this);
163 return null;
164 }
165
166 @override
158 TypeInformation visitNullLiteral(ir.NullLiteral literal) { 167 TypeInformation visitNullLiteral(ir.NullLiteral literal) {
159 return _types.nullType; 168 return _types.nullType;
160 } 169 }
161 170
162 @override 171 @override
163 TypeInformation visitBlock(ir.Block block) { 172 TypeInformation visitBlock(ir.Block block) {
164 for (ir.Statement statement in block.statements) { 173 for (ir.Statement statement in block.statements) {
165 statement.accept(this); 174 statement.accept(this);
166 if (_locals.aborts) break; 175 if (_locals.aborts) break;
167 } 176 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } else { 238 } else {
230 _locals.update(local, visit(node.initializer), node, type); 239 _locals.update(local, visit(node.initializer), node, type);
231 } 240 }
232 return null; 241 return null;
233 } 242 }
234 243
235 @override 244 @override
236 TypeInformation visitVariableGet(ir.VariableGet node) { 245 TypeInformation visitVariableGet(ir.VariableGet node) {
237 return _locals.use(_localsMap.getLocalVariable(node.variable)); 246 return _locals.use(_localsMap.getLocalVariable(node.variable));
238 } 247 }
248
249 @override
250 TypeInformation visitVariableSet(ir.VariableSet node) {
251 Local local = _localsMap.getLocalVariable(node.variable);
252 DartType type = _localsMap.getLocalType(_elementMap, local);
253 TypeInformation rhsType = visit(node.value);
254 _locals.update(local, rhsType, node, type);
255 return rhsType;
256 }
239 } 257 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/inference/data/locals.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698