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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 : locals = new VariableScope.topLevelCopyOf(other.locals), | 292 : locals = new VariableScope.topLevelCopyOf(other.locals), |
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 assert(!(local is LocalElement && !local.isImplementation)); |
302 if (capturedAndBoxed.containsKey(local)) { | 303 if (capturedAndBoxed.containsKey(local)) { |
303 FieldElement field = capturedAndBoxed[local]; | 304 FieldElement field = capturedAndBoxed[local]; |
304 return inferrer.typeOfMember(field); | 305 return inferrer.typeOfMember(field); |
305 } else { | 306 } else { |
306 if (captured.containsKey(local)) { | 307 if (captured.containsKey(local)) { |
307 inferrer.recordCapturedLocalRead(local); | 308 inferrer.recordCapturedLocalRead(local); |
308 } | 309 } |
309 return locals[local]; | 310 return locals[local]; |
310 } | 311 } |
311 } | 312 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 if (newType != type) { | 546 if (newType != type) { |
546 locals[variable] = newType; | 547 locals[variable] = newType; |
547 } | 548 } |
548 }); | 549 }); |
549 } | 550 } |
550 | 551 |
551 void updateField(Element element, TypeInformation type) { | 552 void updateField(Element element, TypeInformation type) { |
552 fieldScope.updateField(element, type); | 553 fieldScope.updateField(element, type); |
553 } | 554 } |
554 } | 555 } |
OLD | NEW |