| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 '../common.dart'; | 5 import '../common.dart'; |
| 6 import '../common/backend_api.dart' show BackendClasses, ForeignResolver; | 6 import '../common/backend_api.dart' show BackendClasses, ForeignResolver; |
| 7 import '../common/resolution.dart' show ParsingContext, Resolution; | 7 import '../common/resolution.dart' show ParsingContext, Resolution; |
| 8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
| 9 import '../compile_time_constants.dart' show ConstantEnvironment; | 9 import '../compile_time_constants.dart' show ConstantEnvironment; |
| 10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
| 11 import '../constants/values.dart'; | 11 import '../constants/values.dart'; |
| 12 import '../common_elements.dart' show CommonElements; | 12 import '../common_elements.dart' show CommonElements; |
| 13 import '../elements/elements.dart'; | 13 import '../elements/elements.dart'; |
| 14 import '../elements/entities.dart'; | 14 import '../elements/entities.dart'; |
| 15 import '../elements/resolution_types.dart'; | 15 import '../elements/resolution_types.dart'; |
| 16 import '../elements/types.dart'; | 16 import '../elements/types.dart'; |
| 17 import '../js/js.dart' as js; | 17 import '../js/js.dart' as js; |
| 18 import '../js_backend/js_backend.dart'; | 18 import '../js_backend/js_backend.dart'; |
| 19 import '../js_backend/backend_helpers.dart'; | 19 import '../js_backend/backend_helpers.dart'; |
| 20 import '../options.dart'; | |
| 21 import '../tree/tree.dart'; | 20 import '../tree/tree.dart'; |
| 22 import '../universe/side_effects.dart' show SideEffects; | 21 import '../universe/side_effects.dart' show SideEffects; |
| 23 import '../util/util.dart'; | 22 import '../util/util.dart'; |
| 24 import 'js.dart'; | 23 import 'js.dart'; |
| 25 | 24 |
| 26 typedef dynamic /*DartType|SpecialType*/ TypeLookup(String typeString, | 25 typedef dynamic /*DartType|SpecialType*/ TypeLookup(String typeString, |
| 27 {bool required}); | 26 {bool required}); |
| 28 | 27 |
| 29 /// This class is a temporary work-around until we get a more powerful DartType. | 28 /// This class is a temporary work-around until we get a more powerful DartType. |
| 30 class SpecialType { | 29 class SpecialType { |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 // functions that never change. | 761 // functions that never change. |
| 763 behavior.sideEffects.setTo(new SideEffects.empty()); | 762 behavior.sideEffects.setTo(new SideEffects.empty()); |
| 764 behavior.throwBehavior = NativeThrowBehavior.NEVER; | 763 behavior.throwBehavior = NativeThrowBehavior.NEVER; |
| 765 _fillNativeBehaviorOfBuiltinOrEmbeddedGlobal( | 764 _fillNativeBehaviorOfBuiltinOrEmbeddedGlobal( |
| 766 behavior, spannable, specString, lookupType, reporter, commonElements, | 765 behavior, spannable, specString, lookupType, reporter, commonElements, |
| 767 validTags: ['returns', 'creates']); | 766 validTags: ['returns', 'creates']); |
| 768 return behavior; | 767 return behavior; |
| 769 } | 768 } |
| 770 | 769 |
| 771 static NativeBehavior ofMethodElement( | 770 static NativeBehavior ofMethodElement( |
| 772 FunctionElement element, Compiler compiler) { | 771 MethodElement element, Compiler compiler) { |
| 773 ResolutionFunctionType type = element.computeType(compiler.resolution); | 772 ResolutionFunctionType type = element.computeType(compiler.resolution); |
| 774 List<ConstantExpression> metadata = <ConstantExpression>[]; | 773 List<ConstantExpression> metadata = <ConstantExpression>[]; |
| 775 for (MetadataAnnotation annotation in element.implementation.metadata) { | 774 for (MetadataAnnotation annotation in element.implementation.metadata) { |
| 776 annotation.ensureResolved(compiler.resolution); | 775 annotation.ensureResolved(compiler.resolution); |
| 777 metadata.add(annotation.constant); | 776 metadata.add(annotation.constant); |
| 778 } | 777 } |
| 779 | 778 |
| 780 BehaviorBuilder builder = new ResolverBehaviorBuilder(compiler); | 779 BehaviorBuilder builder = new ResolverBehaviorBuilder(compiler); |
| 781 return builder.buildMethodBehavior( | 780 return builder.buildMethodBehavior( |
| 782 type, metadata, lookupFromElement(compiler.resolution, element), | 781 type, metadata, lookupFromElement(compiler.resolution, element), |
| 783 isJsInterop: compiler.backend.isJsInterop(element)); | 782 isJsInterop: compiler.backend.nativeData.isJsInterop(element)); |
| 784 } | 783 } |
| 785 | 784 |
| 786 static NativeBehavior ofFieldElementLoad( | 785 static NativeBehavior ofFieldElementLoad( |
| 787 MemberElement element, Compiler compiler) { | 786 MemberElement element, Compiler compiler) { |
| 788 Resolution resolution = compiler.resolution; | 787 Resolution resolution = compiler.resolution; |
| 789 ResolutionDartType type = element.computeType(resolution); | 788 ResolutionDartType type = element.computeType(resolution); |
| 790 List<ConstantExpression> metadata = <ConstantExpression>[]; | 789 List<ConstantExpression> metadata = <ConstantExpression>[]; |
| 791 for (MetadataAnnotation annotation in element.implementation.metadata) { | 790 for (MetadataAnnotation annotation in element.implementation.metadata) { |
| 792 annotation.ensureResolved(compiler.resolution); | 791 annotation.ensureResolved(compiler.resolution); |
| 793 metadata.add(annotation.constant); | 792 metadata.add(annotation.constant); |
| 794 } | 793 } |
| 795 | 794 |
| 796 BehaviorBuilder builder = new ResolverBehaviorBuilder(compiler); | 795 BehaviorBuilder builder = new ResolverBehaviorBuilder(compiler); |
| 797 return builder.buildFieldLoadBehavior( | 796 return builder.buildFieldLoadBehavior( |
| 798 type, metadata, lookupFromElement(resolution, element), | 797 type, metadata, lookupFromElement(resolution, element), |
| 799 isJsInterop: compiler.backend.isJsInterop(element)); | 798 isJsInterop: compiler.backend.nativeData.isJsInterop(element)); |
| 800 } | 799 } |
| 801 | 800 |
| 802 static NativeBehavior ofFieldElementStore( | 801 static NativeBehavior ofFieldElementStore( |
| 803 MemberElement field, Compiler compiler) { | 802 MemberElement field, Compiler compiler) { |
| 804 BehaviorBuilder builder = new ResolverBehaviorBuilder(compiler); | 803 BehaviorBuilder builder = new ResolverBehaviorBuilder(compiler); |
| 805 ResolutionDartType type = field.computeType(compiler.resolution); | 804 ResolutionDartType type = field.computeType(compiler.resolution); |
| 806 return builder.buildFieldStoreBehavior(type); | 805 return builder.buildFieldStoreBehavior(type); |
| 807 } | 806 } |
| 808 | 807 |
| 809 static TypeLookup lookupFromElement(Resolution resolution, Element element) { | 808 static TypeLookup lookupFromElement(Resolution resolution, Element element) { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 JavaScriptBackend backend = compiler.backend; | 1057 JavaScriptBackend backend = compiler.backend; |
| 1059 return backend.helpers; | 1058 return backend.helpers; |
| 1060 } | 1059 } |
| 1061 | 1060 |
| 1062 @override | 1061 @override |
| 1063 BackendClasses get backendClasses => compiler.backend.backendClasses; | 1062 BackendClasses get backendClasses => compiler.backend.backendClasses; |
| 1064 | 1063 |
| 1065 @override | 1064 @override |
| 1066 Resolution get resolution => compiler.resolution; | 1065 Resolution get resolution => compiler.resolution; |
| 1067 } | 1066 } |
| OLD | NEW |