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 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 locals[local] = type; | 329 locals[local] = type; |
330 if (currentType != type) { | 330 if (currentType != type) { |
331 inferrer.recordLocalUpdate(local, type); | 331 inferrer.recordLocalUpdate(local, type); |
332 } | 332 } |
333 } | 333 } |
334 | 334 |
335 if (capturedAndBoxed.containsKey(local)) { | 335 if (capturedAndBoxed.containsKey(local)) { |
336 inferrer.recordTypeOfNonFinalField(node, capturedAndBoxed[local], type); | 336 inferrer.recordTypeOfNonFinalField(node, capturedAndBoxed[local], type); |
337 } else if (inTryBlock) { | 337 } else if (inTryBlock) { |
338 // We don'TypeInformation know if an assignment in a try block | 338 // We don'TypeInformation know if an assignment in a try block |
339 // will be executed, so all assigments in that block are | 339 // will be executed, so all assignments in that block are |
340 // potential types after we have left it. We update the parent | 340 // potential types after we have left it. We update the parent |
341 // of the try block so that, at exit of the try block, we get | 341 // of the try block so that, at exit of the try block, we get |
342 // the right phi for it. | 342 // the right phi for it. |
343 TypeInformation existing = tryBlock.locals.parent[local]; | 343 TypeInformation existing = tryBlock.locals.parent[local]; |
344 if (existing != null) { | 344 if (existing != null) { |
345 TypeInformation phiType = | 345 TypeInformation phiType = |
346 types.allocatePhi(tryBlock.locals.block, local, existing); | 346 types.allocatePhi(tryBlock.locals.block, local, existing); |
347 TypeInformation inputType = types.addPhiInput(local, phiType, type); | 347 TypeInformation inputType = types.addPhiInput(local, phiType, type); |
348 tryBlock.locals.parent[local] = inputType; | 348 tryBlock.locals.parent[local] = inputType; |
349 } | 349 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 if (newType != type) { | 543 if (newType != type) { |
544 locals[variable] = newType; | 544 locals[variable] = newType; |
545 } | 545 } |
546 }); | 546 }); |
547 } | 547 } |
548 | 548 |
549 void updateField(Element element, TypeInformation type) { | 549 void updateField(Element element, TypeInformation type) { |
550 fieldScope.updateField(element, type); | 550 fieldScope.updateField(element, type); |
551 } | 551 } |
552 } | 552 } |
OLD | NEW |