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 ConstructorBodyElement; | |
10 import '../elements/entities.dart'; | 9 import '../elements/entities.dart'; |
11 import '../elements/types.dart'; | 10 import '../elements/types.dart'; |
12 import '../js/js.dart' as jsAst; | 11 import '../js/js.dart' as jsAst; |
13 import '../types/types.dart' show TypeMask; | 12 import '../types/types.dart' show TypeMask; |
14 import '../universe/selector.dart'; | 13 import '../universe/selector.dart'; |
15 import '../world.dart' show ClosedWorld; | 14 import '../world.dart' show ClosedWorld; |
16 import 'namer.dart'; | 15 import 'namer.dart'; |
17 import 'native_data.dart'; | 16 import 'native_data.dart'; |
18 | 17 |
19 abstract class InterceptorData { | 18 abstract class InterceptorData { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 InterceptorDataImpl( | 84 InterceptorDataImpl( |
86 this._nativeData, | 85 this._nativeData, |
87 this._commonElements, | 86 this._commonElements, |
88 this.interceptedMembers, | 87 this.interceptedMembers, |
89 this.interceptedClasses, | 88 this.interceptedClasses, |
90 this.classesMixedIntoInterceptedClasses); | 89 this.classesMixedIntoInterceptedClasses); |
91 | 90 |
92 bool isInterceptedMethod(MemberEntity element) { | 91 bool isInterceptedMethod(MemberEntity element) { |
93 if (!element.isInstanceMember) return false; | 92 if (!element.isInstanceMember) return false; |
94 // TODO(johnniwinther): Avoid this hack. | 93 // TODO(johnniwinther): Avoid this hack. |
95 if (element is ConstructorBodyElement) { | 94 if (element is ConstructorBodyEntity) { |
96 return _nativeData.isNativeOrExtendsNative(element.enclosingClass); | 95 return _nativeData.isNativeOrExtendsNative(element.enclosingClass); |
97 } | 96 } |
98 return interceptedMembers[element.name] != null; | 97 return interceptedMembers[element.name] != null; |
99 } | 98 } |
100 | 99 |
101 bool fieldHasInterceptedGetter(FieldEntity element) { | 100 bool fieldHasInterceptedGetter(FieldEntity element) { |
102 return interceptedMembers[element.name] != null; | 101 return interceptedMembers[element.name] != null; |
103 } | 102 } |
104 | 103 |
105 bool fieldHasInterceptedSetter(FieldEntity element) { | 104 bool fieldHasInterceptedSetter(FieldEntity element) { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 jsAst.Name name = namer.nameForGetInterceptor(classes); | 326 jsAst.Name name = namer.nameForGetInterceptor(classes); |
328 if (classes.contains(_commonElements.jsInterceptorClass)) { | 327 if (classes.contains(_commonElements.jsInterceptorClass)) { |
329 // We can't use a specialized [getInterceptorMethod], so we make | 328 // We can't use a specialized [getInterceptorMethod], so we make |
330 // sure we emit the one with all checks. | 329 // sure we emit the one with all checks. |
331 _specializedGetInterceptors[name] = _interceptorData.interceptedClasses; | 330 _specializedGetInterceptors[name] = _interceptorData.interceptedClasses; |
332 } else { | 331 } else { |
333 _specializedGetInterceptors[name] = classes; | 332 _specializedGetInterceptors[name] = classes; |
334 } | 333 } |
335 } | 334 } |
336 } | 335 } |
OLD | NEW |