| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 js_backend.backend; | 5 library js_backend.backend; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
| 10 | 10 |
| (...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2132 if (!resolution.hasBeenProcessed(member.element)) return; | 2132 if (!resolution.hasBeenProcessed(member.element)) return; |
| 2133 if (referencedFromMirrorSystem(member.element, false)) { | 2133 if (referencedFromMirrorSystem(member.element, false)) { |
| 2134 reflectableMembers.add(member.element); | 2134 reflectableMembers.add(member.element); |
| 2135 } | 2135 } |
| 2136 }); | 2136 }); |
| 2137 // Also add in closures. Those might be reflectable is their enclosing | 2137 // Also add in closures. Those might be reflectable is their enclosing |
| 2138 // member is. | 2138 // member is. |
| 2139 List<LocalFunctionElement> closures = closureMap[cls]; | 2139 List<LocalFunctionElement> closures = closureMap[cls]; |
| 2140 if (closures != null) { | 2140 if (closures != null) { |
| 2141 for (LocalFunctionElement closure in closures) { | 2141 for (LocalFunctionElement closure in closures) { |
| 2142 if (referencedFromMirrorSystem(closure.memberContext, false)) { | 2142 MemberElement member = closure.memberContext; |
| 2143 if (referencedFromMirrorSystem(member, false)) { |
| 2143 reflectableMembers.add(closure); | 2144 reflectableMembers.add(closure); |
| 2144 foundClosure = true; | 2145 foundClosure = true; |
| 2145 } | 2146 } |
| 2146 } | 2147 } |
| 2147 } | 2148 } |
| 2148 } | 2149 } |
| 2149 } | 2150 } |
| 2150 // We also need top-level non-class elements like static functions and | 2151 // We also need top-level non-class elements like static functions and |
| 2151 // global fields. We use the resolution queue to decide which elements are | 2152 // global fields. We use the resolution queue to decide which elements are |
| 2152 // part of the live world. | 2153 // part of the live world. |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2885 | 2886 |
| 2886 for (MapLiteralUse mapLiteralUse in worldImpact.mapLiterals) { | 2887 for (MapLiteralUse mapLiteralUse in worldImpact.mapLiterals) { |
| 2887 // TODO(johnniwinther): Use the [isEmpty] property when factory | 2888 // TODO(johnniwinther): Use the [isEmpty] property when factory |
| 2888 // constructors are registered directly. | 2889 // constructors are registered directly. |
| 2889 if (mapLiteralUse.isConstant) { | 2890 if (mapLiteralUse.isConstant) { |
| 2890 registerBackendImpact(transformed, impacts.constantMapLiteral); | 2891 registerBackendImpact(transformed, impacts.constantMapLiteral); |
| 2891 } else { | 2892 } else { |
| 2892 transformed | 2893 transformed |
| 2893 .registerTypeUse(new TypeUse.instantiation(mapLiteralUse.type)); | 2894 .registerTypeUse(new TypeUse.instantiation(mapLiteralUse.type)); |
| 2894 } | 2895 } |
| 2895 registerRequiredType(mapLiteralUse.type); | 2896 ResolutionInterfaceType type = mapLiteralUse.type; |
| 2897 registerRequiredType(type); |
| 2896 } | 2898 } |
| 2897 | 2899 |
| 2898 for (ListLiteralUse listLiteralUse in worldImpact.listLiterals) { | 2900 for (ListLiteralUse listLiteralUse in worldImpact.listLiterals) { |
| 2899 // TODO(johnniwinther): Use the [isConstant] and [isEmpty] property when | 2901 // TODO(johnniwinther): Use the [isConstant] and [isEmpty] property when |
| 2900 // factory constructors are registered directly. | 2902 // factory constructors are registered directly. |
| 2901 transformed | 2903 transformed |
| 2902 .registerTypeUse(new TypeUse.instantiation(listLiteralUse.type)); | 2904 .registerTypeUse(new TypeUse.instantiation(listLiteralUse.type)); |
| 2903 registerRequiredType(listLiteralUse.type); | 2905 ResolutionInterfaceType type = listLiteralUse.type; |
| 2906 registerRequiredType(type); |
| 2904 } | 2907 } |
| 2905 | 2908 |
| 2906 if (worldImpact.constSymbolNames.isNotEmpty) { | 2909 if (worldImpact.constSymbolNames.isNotEmpty) { |
| 2907 registerBackendImpact(transformed, impacts.constSymbol); | 2910 registerBackendImpact(transformed, impacts.constSymbol); |
| 2908 for (String constSymbolName in worldImpact.constSymbolNames) { | 2911 for (String constSymbolName in worldImpact.constSymbolNames) { |
| 2909 backend.registerConstSymbol(constSymbolName); | 2912 backend.registerConstSymbol(constSymbolName); |
| 2910 } | 2913 } |
| 2911 } | 2914 } |
| 2912 | 2915 |
| 2913 for (StaticUse staticUse in worldImpact.staticUses) { | 2916 for (StaticUse staticUse in worldImpact.staticUses) { |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3303 @override | 3306 @override |
| 3304 bool isNativeClass(ClassElement element) { | 3307 bool isNativeClass(ClassElement element) { |
| 3305 return helpers.backend.isNative(element); | 3308 return helpers.backend.isNative(element); |
| 3306 } | 3309 } |
| 3307 | 3310 |
| 3308 @override | 3311 @override |
| 3309 bool isNativeMember(MemberElement element) { | 3312 bool isNativeMember(MemberElement element) { |
| 3310 return helpers.backend.isNative(element); | 3313 return helpers.backend.isNative(element); |
| 3311 } | 3314 } |
| 3312 } | 3315 } |
| OLD | NEW |