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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 ClassEntity getClass(ir.Class node) => _getClass(node); | 672 ClassEntity getClass(ir.Class node) => _getClass(node); |
673 | 673 |
674 @override | 674 @override |
675 FieldEntity getField(ir.Field node) => _getField(node); | 675 FieldEntity getField(ir.Field node) => _getField(node); |
676 | 676 |
677 bool hasConstantFieldInitializer(KField field) { | 677 bool hasConstantFieldInitializer(KField field) { |
678 _FieldData data = _memberList[field.memberIndex]; | 678 _FieldData data = _memberList[field.memberIndex]; |
679 return getFieldConstantValue(data.node) != null; | 679 return getFieldConstantValue(data.node) != null; |
680 } | 680 } |
681 | 681 |
| 682 ConstantValue getConstantFieldInitializer(KField field) { |
| 683 _FieldData data = _memberList[field.memberIndex]; |
| 684 ConstantValue value = getFieldConstantValue(data.node); |
| 685 assert(value != null, |
| 686 failedAt(field, "Field $field doesn't have a constant initial value.")); |
| 687 return value; |
| 688 } |
| 689 |
682 TypeVariableEntity getTypeVariable(ir.TypeParameter node) => | 690 TypeVariableEntity getTypeVariable(ir.TypeParameter node) => |
683 _getTypeVariable(node); | 691 _getTypeVariable(node); |
684 | 692 |
685 @override | 693 @override |
686 FunctionEntity getMethod(ir.Procedure node) => _getMethod(node); | 694 FunctionEntity getMethod(ir.Procedure node) => _getMethod(node); |
687 | 695 |
688 void forEachParameter(KFunction function, | 696 void forEachParameter(KFunction function, |
689 void f(DartType type, String name, ConstantValue defaultValue)) { | 697 void f(DartType type, String name, ConstantValue defaultValue)) { |
690 _FunctionData data = _memberList[function.memberIndex]; | 698 _FunctionData data = _memberList[function.memberIndex]; |
691 data.forEachParameter(this, f); | 699 data.forEachParameter(this, f); |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1733 return node.isExternal && | 1741 return node.isExternal && |
1734 !elementMap.isForeignLibrary(node.enclosingLibrary); | 1742 !elementMap.isForeignLibrary(node.enclosingLibrary); |
1735 } | 1743 } |
1736 | 1744 |
1737 @override | 1745 @override |
1738 bool isJsInteropMember(MemberEntity element) { | 1746 bool isJsInteropMember(MemberEntity element) { |
1739 // TODO(johnniwinther): Compute this. | 1747 // TODO(johnniwinther): Compute this. |
1740 return false; | 1748 return false; |
1741 } | 1749 } |
1742 } | 1750 } |
OLD | NEW |