OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Implementation of the element model used for deserialiation. | 5 /// Implementation of the element model used for deserialiation. |
6 /// | 6 /// |
7 /// These classes are created by [ElementDeserializer] triggered by the | 7 /// These classes are created by [ElementDeserializer] triggered by the |
8 /// [Deserializer]. | 8 /// [Deserializer]. |
9 | 9 |
10 library dart2js.serialization.modelz; | 10 library dart2js.serialization.modelz; |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 | 581 |
582 @override | 582 @override |
583 bool get isTopLevel => true; | 583 bool get isTopLevel => true; |
584 | 584 |
585 @override | 585 @override |
586 bool get isStatic => false; | 586 bool get isStatic => false; |
587 } | 587 } |
588 | 588 |
589 abstract class ClassMemberMixin implements DeserializedElementZ { | 589 abstract class ClassMemberMixin implements DeserializedElementZ { |
590 ClassElement _class; | 590 ClassElement _class; |
| 591 CompilationUnitElement _compilationUnit; |
591 | 592 |
592 @override | 593 @override |
593 Element get enclosingElement => enclosingClass; | 594 Element get enclosingElement => enclosingClass; |
594 | 595 |
595 @override | 596 @override |
596 ClassElement get enclosingClass { | 597 ClassElement get enclosingClass { |
597 if (_class == null) { | 598 if (_class == null) { |
598 _class = _decoder.getElement(Key.CLASS); | 599 _class = _decoder.getElement(Key.CLASS); |
599 } | 600 } |
600 return _class; | 601 return _class; |
601 } | 602 } |
602 | 603 |
603 @override | 604 @override |
604 bool get isClassMember => true; | 605 bool get isClassMember => true; |
605 | 606 |
606 @override | 607 @override |
607 LibraryElement get library => enclosingClass.library; | 608 LibraryElement get library => enclosingClass.library; |
608 | 609 |
609 @override | 610 @override |
610 CompilationUnitElement get compilationUnit => enclosingClass.compilationUnit; | 611 CompilationUnitElement get compilationUnit { |
| 612 if (_compilationUnit == null) { |
| 613 _compilationUnit = |
| 614 _decoder.getElement(Key.COMPILATION_UNIT, isOptional: true); |
| 615 if (_compilationUnit == null) { |
| 616 _compilationUnit = enclosingClass.compilationUnit; |
| 617 } |
| 618 } |
| 619 return _compilationUnit; |
| 620 } |
611 } | 621 } |
612 | 622 |
613 abstract class InstanceMemberMixin implements DeserializedElementZ { | 623 abstract class InstanceMemberMixin implements DeserializedElementZ { |
614 @override | 624 @override |
615 bool get isTopLevel => false; | 625 bool get isTopLevel => false; |
616 | 626 |
617 @override | 627 @override |
618 bool get isStatic => false; | 628 bool get isStatic => false; |
619 | 629 |
620 @override | 630 @override |
(...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1958 } | 1968 } |
1959 | 1969 |
1960 @override | 1970 @override |
1961 ElementKind get kind => ElementKind.PREFIX; | 1971 ElementKind get kind => ElementKind.PREFIX; |
1962 | 1972 |
1963 @override | 1973 @override |
1964 Element lookupLocalMember(String memberName) { | 1974 Element lookupLocalMember(String memberName) { |
1965 return _unsupported('lookupLocalMember'); | 1975 return _unsupported('lookupLocalMember'); |
1966 } | 1976 } |
1967 } | 1977 } |
OLD | NEW |