OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 dart2js.kernel.element_map; | 5 library dart2js.kernel.element_map; |
6 | 6 |
7 import 'package:kernel/ast.dart' as ir; | 7 import 'package:kernel/ast.dart' as ir; |
8 import 'package:kernel/clone.dart'; | 8 import 'package:kernel/clone.dart'; |
9 import 'package:kernel/type_algebra.dart'; | 9 import 'package:kernel/type_algebra.dart'; |
10 | 10 |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 _KClassEnv env = _classEnvs[cls.classIndex]; | 767 _KClassEnv env = _classEnvs[cls.classIndex]; |
768 _ensureSupertypes(cls, env); | 768 _ensureSupertypes(cls, env); |
769 return env.interfaces; | 769 return env.interfaces; |
770 } | 770 } |
771 | 771 |
772 ir.Library getKernelLibrary(KLibrary entity) => | 772 ir.Library getKernelLibrary(KLibrary entity) => |
773 _libraryEnvs[entity.libraryIndex].library; | 773 _libraryEnvs[entity.libraryIndex].library; |
774 | 774 |
775 ir.Class getKernelClass(KClass entity) => _classEnvs[entity.classIndex].cls; | 775 ir.Class getKernelClass(KClass entity) => _classEnvs[entity.classIndex].cls; |
776 | 776 |
| 777 ir.Member getKernelMember(KMember entity) => |
| 778 _memberList[entity.memberIndex].node; |
| 779 |
777 bool hasConstantFieldInitializer(covariant KField field) { | 780 bool hasConstantFieldInitializer(covariant KField field) { |
778 _FieldData data = _memberList[field.memberIndex]; | 781 _FieldData data = _memberList[field.memberIndex]; |
779 return getFieldConstantValue(data.node) != null; | 782 return getFieldConstantValue(data.node) != null; |
780 } | 783 } |
781 | 784 |
782 ConstantValue getConstantFieldInitializer(covariant KField field) { | 785 ConstantValue getConstantFieldInitializer(covariant KField field) { |
783 _FieldData data = _memberList[field.memberIndex]; | 786 _FieldData data = _memberList[field.memberIndex]; |
784 ConstantValue value = getFieldConstantValue(data.node); | 787 ConstantValue value = getFieldConstantValue(data.node); |
785 assert(value != null, | 788 assert(value != null, |
786 failedAt(field, "Field $field doesn't have a constant initial value.")); | 789 failedAt(field, "Field $field doesn't have a constant initial value.")); |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1823 return _elementMap.getSpannable(_map.toFrontendMember(member), node); | 1826 return _elementMap.getSpannable(_map.toFrontendMember(member), node); |
1824 } | 1827 } |
1825 | 1828 |
1826 @override | 1829 @override |
1827 LibraryEntity getLibrary(ir.Library node) { | 1830 LibraryEntity getLibrary(ir.Library node) { |
1828 return _map.toBackendLibrary(_elementMap.getLibrary(node)); | 1831 return _map.toBackendLibrary(_elementMap.getLibrary(node)); |
1829 } | 1832 } |
1830 | 1833 |
1831 @override | 1834 @override |
1832 Local getLocalFunction(ir.TreeNode node) { | 1835 Local getLocalFunction(ir.TreeNode node) { |
1833 throw new UnsupportedError("JsKernelToElementMap.getLocalFunction"); | 1836 // TODO(efortuna, johnniwinther): This function should not be called once |
| 1837 // the K + J element situation has been properly sorted out. Ultimately this |
| 1838 // should throw. |
| 1839 return _elementMap.getLocalFunction(node); |
1834 } | 1840 } |
1835 | 1841 |
1836 @override | 1842 @override |
1837 ClassEntity getClass(ir.Class node) { | 1843 ClassEntity getClass(ir.Class node) { |
1838 return _map.toBackendClass(_elementMap.getClass(node)); | 1844 return _map.toBackendClass(_elementMap.getClass(node)); |
1839 } | 1845 } |
1840 | 1846 |
1841 @override | 1847 @override |
1842 FieldEntity getField(ir.Field node) { | 1848 FieldEntity getField(ir.Field node) { |
1843 return _map.toBackendMember(_elementMap.getField(node)); | 1849 return _map.toBackendMember(_elementMap.getField(node)); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 throw new UnsupportedError( | 1940 throw new UnsupportedError( |
1935 "JsKernelToElementMap.getConstantFieldInitializer"); | 1941 "JsKernelToElementMap.getConstantFieldInitializer"); |
1936 } | 1942 } |
1937 | 1943 |
1938 @override | 1944 @override |
1939 bool hasConstantFieldInitializer(FieldEntity field) { | 1945 bool hasConstantFieldInitializer(FieldEntity field) { |
1940 throw new UnsupportedError( | 1946 throw new UnsupportedError( |
1941 "JsKernelToElementMap.hasConstantFieldInitializer"); | 1947 "JsKernelToElementMap.hasConstantFieldInitializer"); |
1942 } | 1948 } |
1943 } | 1949 } |
OLD | NEW |