| 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 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 import '../environment.dart'; | 23 import '../environment.dart'; |
| 24 import '../frontend_strategy.dart'; | 24 import '../frontend_strategy.dart'; |
| 25 import '../js_backend/constant_system_javascript.dart'; | 25 import '../js_backend/constant_system_javascript.dart'; |
| 26 import '../js_backend/interceptor_data.dart'; | 26 import '../js_backend/interceptor_data.dart'; |
| 27 import '../js_backend/native_data.dart'; | 27 import '../js_backend/native_data.dart'; |
| 28 import '../js_backend/no_such_method_registry.dart'; | 28 import '../js_backend/no_such_method_registry.dart'; |
| 29 import '../native/native.dart' as native; | 29 import '../native/native.dart' as native; |
| 30 import '../native/resolver.dart'; | 30 import '../native/resolver.dart'; |
| 31 import '../ordered_typeset.dart'; | 31 import '../ordered_typeset.dart'; |
| 32 import '../ssa/kernel_impact.dart'; | 32 import '../ssa/kernel_impact.dart'; |
| 33 import '../universe/call_structure.dart'; | |
| 34 import '../universe/world_builder.dart'; | 33 import '../universe/world_builder.dart'; |
| 35 import '../util/util.dart' show Link, LinkBuilder; | 34 import '../util/util.dart' show Link, LinkBuilder; |
| 36 import 'element_map.dart'; | 35 import 'element_map.dart'; |
| 37 import 'elements.dart'; | 36 import 'elements.dart'; |
| 38 | 37 |
| 39 part 'native_basic_data.dart'; | 38 part 'native_basic_data.dart'; |
| 40 part 'no_such_method_resolver.dart'; | 39 part 'no_such_method_resolver.dart'; |
| 41 part 'types.dart'; | 40 part 'types.dart'; |
| 42 | 41 |
| 43 /// Element builder used for creating elements and types corresponding to Kernel | 42 /// Element builder used for creating elements and types corresponding to Kernel |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 } | 873 } |
| 875 | 874 |
| 876 Iterable<ConstantValue> getMetadata(KernelToElementMapImpl elementMap) { | 875 Iterable<ConstantValue> getMetadata(KernelToElementMapImpl elementMap) { |
| 877 return _metadata ??= elementMap.getMetadata(node.annotations); | 876 return _metadata ??= elementMap.getMetadata(node.annotations); |
| 878 } | 877 } |
| 879 } | 878 } |
| 880 | 879 |
| 881 class _FunctionData extends _MemberData { | 880 class _FunctionData extends _MemberData { |
| 882 final ir.FunctionNode functionNode; | 881 final ir.FunctionNode functionNode; |
| 883 FunctionType _type; | 882 FunctionType _type; |
| 884 CallStructure _callStructure; | |
| 885 | 883 |
| 886 _FunctionData(ir.Member node, this.functionNode) : super(node); | 884 _FunctionData(ir.Member node, this.functionNode) : super(node); |
| 887 | 885 |
| 888 FunctionType getFunctionType(KernelToElementMapImpl elementMap) { | 886 FunctionType getFunctionType(KernelToElementMapImpl elementMap) { |
| 889 return _type ??= elementMap.getFunctionType(functionNode); | 887 return _type ??= elementMap.getFunctionType(functionNode); |
| 890 } | 888 } |
| 891 | |
| 892 CallStructure get callStructure { | |
| 893 return _callStructure ??= new CallStructure( | |
| 894 functionNode.positionalParameters.length + | |
| 895 functionNode.namedParameters.length, | |
| 896 functionNode.namedParameters.map((d) => d.name).toList()); | |
| 897 } | |
| 898 } | 889 } |
| 899 | 890 |
| 900 class _ConstructorData extends _FunctionData { | 891 class _ConstructorData extends _FunctionData { |
| 901 ConstantConstructor _constantConstructor; | 892 ConstantConstructor _constantConstructor; |
| 902 | 893 |
| 903 _ConstructorData(ir.Member node, ir.FunctionNode functionNode) | 894 _ConstructorData(ir.Member node, ir.FunctionNode functionNode) |
| 904 : super(node, functionNode); | 895 : super(node, functionNode); |
| 905 | 896 |
| 906 ConstantConstructor getConstructorConstant( | 897 ConstantConstructor getConstructorConstant( |
| 907 KernelToElementMapImpl elementMap, KConstructor constructor) { | 898 KernelToElementMapImpl elementMap, KConstructor constructor) { |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 LibraryEntity lookupLibrary(Uri uri, {bool required: false}) { | 1089 LibraryEntity lookupLibrary(Uri uri, {bool required: false}) { |
| 1099 LibraryEntity library = elementMap.lookupLibrary(uri); | 1090 LibraryEntity library = elementMap.lookupLibrary(uri); |
| 1100 if (library == null && required) { | 1091 if (library == null && required) { |
| 1101 throw new SpannableAssertionFailure( | 1092 throw new SpannableAssertionFailure( |
| 1102 CURRENT_ELEMENT_SPANNABLE, "The library '$uri' was not found."); | 1093 CURRENT_ELEMENT_SPANNABLE, "The library '$uri' was not found."); |
| 1103 } | 1094 } |
| 1104 return library; | 1095 return library; |
| 1105 } | 1096 } |
| 1106 | 1097 |
| 1107 @override | 1098 @override |
| 1108 CallStructure getCallStructure(KFunction function) { | |
| 1109 _FunctionData data = elementMap._memberList[function.memberIndex]; | |
| 1110 return data.callStructure; | |
| 1111 } | |
| 1112 | |
| 1113 @override | |
| 1114 bool isDeferredLoadLibraryGetter(KMember member) { | 1099 bool isDeferredLoadLibraryGetter(KMember member) { |
| 1115 // TODO(johnniwinther): Support these. | 1100 // TODO(johnniwinther): Support these. |
| 1116 return false; | 1101 return false; |
| 1117 } | 1102 } |
| 1118 | 1103 |
| 1119 @override | 1104 @override |
| 1120 Iterable<ConstantValue> getMemberMetadata(KMember member) { | 1105 Iterable<ConstantValue> getMemberMetadata(KMember member) { |
| 1121 _MemberData memberData = elementMap._memberList[member.memberIndex]; | 1106 _MemberData memberData = elementMap._memberList[member.memberIndex]; |
| 1122 return memberData.getMetadata(elementMap); | 1107 return memberData.getMetadata(elementMap); |
| 1123 } | 1108 } |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 return node.isExternal && | 1393 return node.isExternal && |
| 1409 !elementMap.isForeignLibrary(node.enclosingLibrary); | 1394 !elementMap.isForeignLibrary(node.enclosingLibrary); |
| 1410 } | 1395 } |
| 1411 | 1396 |
| 1412 @override | 1397 @override |
| 1413 bool isJsInteropMember(MemberEntity element) { | 1398 bool isJsInteropMember(MemberEntity element) { |
| 1414 // TODO(johnniwinther): Compute this. | 1399 // TODO(johnniwinther): Compute this. |
| 1415 return false; | 1400 return false; |
| 1416 } | 1401 } |
| 1417 } | 1402 } |
| OLD | NEW |