OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 '../closure.dart'; | 5 import '../closure.dart'; |
6 import '../common.dart'; | 6 import '../common.dart'; |
7 import '../elements/elements.dart'; | 7 import '../elements/elements.dart'; |
8 import '../elements/entities.dart'; | 8 import '../elements/entities.dart'; |
9 import '../elements/types.dart'; | 9 import '../elements/types.dart'; |
10 import '../io/source_information.dart'; | 10 import '../io/source_information.dart'; |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 }); | 624 }); |
625 return this; | 625 return this; |
626 } | 626 } |
627 | 627 |
628 TypeMask cachedTypeOfThis; | 628 TypeMask cachedTypeOfThis; |
629 | 629 |
630 TypeMask getTypeOfThis() { | 630 TypeMask getTypeOfThis() { |
631 TypeMask result = cachedTypeOfThis; | 631 TypeMask result = cachedTypeOfThis; |
632 if (result == null) { | 632 if (result == null) { |
633 ThisLocal local = closureData.thisLocal; | 633 ThisLocal local = closureData.thisLocal; |
634 ClassElement cls = local.enclosingClass; | 634 ClassEntity cls = local.enclosingClass; |
635 if (closedWorld.isUsedAsMixin(cls)) { | 635 if (closedWorld.isUsedAsMixin(cls)) { |
636 // If the enclosing class is used as a mixin, [:this:] can be | 636 // If the enclosing class is used as a mixin, [:this:] can be |
637 // of the class that mixins the enclosing class. These two | 637 // of the class that mixins the enclosing class. These two |
638 // classes do not have a subclass relationship, so, for | 638 // classes do not have a subclass relationship, so, for |
639 // simplicity, we mark the type as an interface type. | 639 // simplicity, we mark the type as an interface type. |
640 result = new TypeMask.nonNullSubtype(cls.declaration, closedWorld); | 640 result = new TypeMask.nonNullSubtype(cls, closedWorld); |
641 } else { | 641 } else { |
642 result = new TypeMask.nonNullSubclass(cls.declaration, closedWorld); | 642 result = new TypeMask.nonNullSubclass(cls, closedWorld); |
643 } | 643 } |
644 cachedTypeOfThis = result; | 644 cachedTypeOfThis = result; |
645 } | 645 } |
646 return result; | 646 return result; |
647 } | 647 } |
648 | 648 |
649 Map<Element, TypeMask> cachedTypesOfCapturedVariables = | 649 Map<Element, TypeMask> cachedTypesOfCapturedVariables = |
650 new Map<Element, TypeMask>(); | 650 new Map<Element, TypeMask>(); |
651 | 651 |
652 TypeMask getTypeOfCapturedVariable(FieldElement element) { | 652 TypeMask getTypeOfCapturedVariable(FieldElement element) { |
(...skipping 23 matching lines...) Expand all Loading... |
676 final MemberEntity memberContext; | 676 final MemberEntity memberContext; |
677 | 677 |
678 // Avoid slow Object.hashCode. | 678 // Avoid slow Object.hashCode. |
679 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); | 679 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); |
680 static int _nextHashCode = 0; | 680 static int _nextHashCode = 0; |
681 | 681 |
682 SyntheticLocal(this.name, this.executableContext, this.memberContext); | 682 SyntheticLocal(this.name, this.executableContext, this.memberContext); |
683 | 683 |
684 toString() => 'SyntheticLocal($name)'; | 684 toString() => 'SyntheticLocal($name)'; |
685 } | 685 } |
OLD | NEW |