OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Analysis to determine how to generate code for typed JavaScript interop. | 5 /// Analysis to determine how to generate code for typed JavaScript interop. |
6 library compiler.src.js_backend.js_interop_analysis; | 6 library compiler.src.js_backend.js_interop_analysis; |
7 | 7 |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../constants/values.dart' | 9 import '../constants/values.dart' |
10 show ConstantValue, ConstructedConstantValue, StringConstantValue; | 10 show ConstantValue, ConstructedConstantValue, StringConstantValue; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 MessageKind.JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, { | 147 MessageKind.JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, { |
148 'cls': classElement.name, | 148 'cls': classElement.name, |
149 'superclass': classElement.superclass.name | 149 'superclass': classElement.superclass.name |
150 }); | 150 }); |
151 } | 151 } |
152 | 152 |
153 classElement | 153 classElement |
154 .forEachMember((ClassElement classElement, MemberElement member) { | 154 .forEachMember((ClassElement classElement, MemberElement member) { |
155 String memberName = processJsInteropAnnotation(member); | 155 String memberName = processJsInteropAnnotation(member); |
156 if (memberName != null) { | 156 if (memberName != null) { |
157 backend.nativeDataBuilder.setJsInteropMemberName(element, memberName); | 157 backend.nativeDataBuilder.setJsInteropMemberName(member, memberName); |
158 } | 158 } |
159 | 159 |
160 if (!member.isSynthesized && | 160 if (!member.isSynthesized && |
161 backend.nativeData.isJsInteropClass(classElement) && | 161 backend.nativeData.isJsInteropClass(classElement) && |
162 member is MethodElement) { | 162 member is MethodElement) { |
163 MethodElement fn = member; | 163 MethodElement fn = member; |
164 if (!fn.isExternal && | 164 if (!fn.isExternal && |
165 !fn.isAbstract && | 165 !fn.isAbstract && |
166 !fn.isConstructor && | 166 !fn.isConstructor && |
167 !fn.isStatic) { | 167 !fn.isStatic) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 ResolutionFunctionType buildJsFunctionType() { | 218 ResolutionFunctionType buildJsFunctionType() { |
219 // TODO(jacobr): consider using codegenWorldBuilder.isChecks to determine th
e | 219 // TODO(jacobr): consider using codegenWorldBuilder.isChecks to determine th
e |
220 // range of positional arguments that need to be supported by JavaScript | 220 // range of positional arguments that need to be supported by JavaScript |
221 // function types. | 221 // function types. |
222 return new ResolutionFunctionType.synthesized( | 222 return new ResolutionFunctionType.synthesized( |
223 const ResolutionDynamicType(), | 223 const ResolutionDynamicType(), |
224 [], | 224 [], |
225 new List<ResolutionDartType>.filled(16, const ResolutionDynamicType())); | 225 new List<ResolutionDartType>.filled(16, const ResolutionDynamicType())); |
226 } | 226 } |
227 } | 227 } |
OLD | NEW |