| 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 js_backend.interceptor_data; | 5 library js_backend.interceptor_data; |
| 6 | 6 |
| 7 import '../common/names.dart' show Identifiers; | 7 import '../common/names.dart' show Identifiers; |
| 8 import '../common_elements.dart' show CommonElements, ElementEnvironment; | 8 import '../common_elements.dart' show CommonElements, ElementEnvironment; |
| 9 import '../elements/elements.dart' show MemberElement; | 9 import '../elements/elements.dart' show ConstructorBodyElement; |
| 10 import '../elements/entities.dart'; | 10 import '../elements/entities.dart'; |
| 11 import '../elements/types.dart'; | 11 import '../elements/types.dart'; |
| 12 import '../js/js.dart' as jsAst; | 12 import '../js/js.dart' as jsAst; |
| 13 import '../types/types.dart' show TypeMask; | 13 import '../types/types.dart' show TypeMask; |
| 14 import '../universe/selector.dart'; | 14 import '../universe/selector.dart'; |
| 15 import '../world.dart' show ClosedWorld; | 15 import '../world.dart' show ClosedWorld; |
| 16 import 'namer.dart'; | 16 import 'namer.dart'; |
| 17 import 'native_data.dart'; | 17 import 'native_data.dart'; |
| 18 | 18 |
| 19 abstract class InterceptorData { | 19 abstract class InterceptorData { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 final Set<ClassEntity> _noClasses = new Set<ClassEntity>(); | 83 final Set<ClassEntity> _noClasses = new Set<ClassEntity>(); |
| 84 | 84 |
| 85 InterceptorDataImpl( | 85 InterceptorDataImpl( |
| 86 this._nativeData, | 86 this._nativeData, |
| 87 this._commonElements, | 87 this._commonElements, |
| 88 this._interceptedElements, | 88 this._interceptedElements, |
| 89 this._interceptedClasses, | 89 this._interceptedClasses, |
| 90 this._classesMixedIntoInterceptedClasses); | 90 this._classesMixedIntoInterceptedClasses); |
| 91 | 91 |
| 92 bool isInterceptedMethod(MemberElement element) { | 92 bool isInterceptedMethod(MemberEntity element) { |
| 93 if (!element.isInstanceMember) return false; | 93 if (!element.isInstanceMember) return false; |
| 94 if (element.isGenerativeConstructorBody) { | 94 // TODO(johnniwinther): Avoid this hack. |
| 95 if (element is ConstructorBodyElement) { |
| 95 return _nativeData.isNativeOrExtendsNative(element.enclosingClass); | 96 return _nativeData.isNativeOrExtendsNative(element.enclosingClass); |
| 96 } | 97 } |
| 97 return _interceptedElements[element.name] != null; | 98 return _interceptedElements[element.name] != null; |
| 98 } | 99 } |
| 99 | 100 |
| 100 bool fieldHasInterceptedGetter(FieldEntity element) { | 101 bool fieldHasInterceptedGetter(FieldEntity element) { |
| 101 return _interceptedElements[element.name] != null; | 102 return _interceptedElements[element.name] != null; |
| 102 } | 103 } |
| 103 | 104 |
| 104 bool fieldHasInterceptedSetter(FieldEntity element) { | 105 bool fieldHasInterceptedSetter(FieldEntity element) { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 jsAst.Name name = namer.nameForGetInterceptor(classes); | 335 jsAst.Name name = namer.nameForGetInterceptor(classes); |
| 335 if (classes.contains(_commonElements.jsInterceptorClass)) { | 336 if (classes.contains(_commonElements.jsInterceptorClass)) { |
| 336 // We can't use a specialized [getInterceptorMethod], so we make | 337 // We can't use a specialized [getInterceptorMethod], so we make |
| 337 // sure we emit the one with all checks. | 338 // sure we emit the one with all checks. |
| 338 _specializedGetInterceptors[name] = _interceptorData.interceptedClasses; | 339 _specializedGetInterceptors[name] = _interceptorData.interceptedClasses; |
| 339 } else { | 340 } else { |
| 340 _specializedGetInterceptors[name] = classes; | 341 _specializedGetInterceptors[name] = classes; |
| 341 } | 342 } |
| 342 } | 343 } |
| 343 } | 344 } |
| OLD | NEW |