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

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

Issue 2955353002: Split inference type-info accessors into members, parameters and local functions (Closed)
Patch Set: Cleanup Created 3 years, 5 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
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 locals_handler; 5 library locals_handler;
6 6
7 import 'dart:collection' show IterableMixin; 7 import 'dart:collection' show IterableMixin;
8 8
9 import '../options.dart' show CompilerOptions; 9 import '../options.dart' show CompilerOptions;
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 fieldScope = new FieldInitializationScope.from(other.fieldScope), 293 fieldScope = new FieldInitializationScope.from(other.fieldScope),
294 captured = other.captured, 294 captured = other.captured,
295 capturedAndBoxed = other.capturedAndBoxed, 295 capturedAndBoxed = other.capturedAndBoxed,
296 tryBlock = other.tryBlock, 296 tryBlock = other.tryBlock,
297 types = other.types, 297 types = other.types,
298 inferrer = other.inferrer, 298 inferrer = other.inferrer,
299 options = other.options; 299 options = other.options;
300 300
301 TypeInformation use(Local local) { 301 TypeInformation use(Local local) {
302 if (capturedAndBoxed.containsKey(local)) { 302 if (capturedAndBoxed.containsKey(local)) {
303 return inferrer.typeOfElement(capturedAndBoxed[local]); 303 FieldElement field = capturedAndBoxed[local];
304 return inferrer.typeOfMember(field);
304 } else { 305 } else {
305 if (captured.containsKey(local)) { 306 if (captured.containsKey(local)) {
306 inferrer.recordCapturedLocalRead(local); 307 inferrer.recordCapturedLocalRead(local);
307 } 308 }
308 return locals[local]; 309 return locals[local];
309 } 310 }
310 } 311 }
311 312
312 void update(LocalElement local, TypeInformation type, Node node) { 313 void update(LocalElement local, TypeInformation type, Node node) {
313 assert(type != null); 314 assert(type != null);
(...skipping 13 matching lines...) Expand all
327 locals.block, local, types.narrowNotNull(currentType)), 328 locals.block, local, types.narrowNotNull(currentType)),
328 type); 329 type);
329 } 330 }
330 locals[local] = type; 331 locals[local] = type;
331 if (currentType != type) { 332 if (currentType != type) {
332 inferrer.recordLocalUpdate(local, type); 333 inferrer.recordLocalUpdate(local, type);
333 } 334 }
334 } 335 }
335 336
336 if (capturedAndBoxed.containsKey(local)) { 337 if (capturedAndBoxed.containsKey(local)) {
337 inferrer.recordTypeOfNonFinalField(node, capturedAndBoxed[local], type); 338 inferrer.recordTypeOfNonFinalField(capturedAndBoxed[local], type);
338 } else if (inTryBlock) { 339 } else if (inTryBlock) {
339 // We don'TypeInformation know if an assignment in a try block 340 // We don'TypeInformation know if an assignment in a try block
340 // will be executed, so all assignments in that block are 341 // will be executed, so all assignments in that block are
341 // potential types after we have left it. We update the parent 342 // potential types after we have left it. We update the parent
342 // of the try block so that, at exit of the try block, we get 343 // of the try block so that, at exit of the try block, we get
343 // the right phi for it. 344 // the right phi for it.
344 TypeInformation existing = tryBlock.locals.parent[local]; 345 TypeInformation existing = tryBlock.locals.parent[local];
345 if (existing != null) { 346 if (existing != null) {
346 TypeInformation phiType = 347 TypeInformation phiType =
347 types.allocatePhi(tryBlock.locals.block, local, existing); 348 types.allocatePhi(tryBlock.locals.block, local, existing);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 if (newType != type) { 545 if (newType != type) {
545 locals[variable] = newType; 546 locals[variable] = newType;
546 } 547 }
547 }); 548 });
548 } 549 }
549 550
550 void updateField(Element element, TypeInformation type) { 551 void updateField(Element element, TypeInformation type) {
551 fieldScope.updateField(element, type); 552 fieldScope.updateField(element, type);
552 } 553 }
553 } 554 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698