| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 if (element is FunctionElement) { | 109 if (element is FunctionElement) { |
| 110 _checkFunctionParameters(element); | 110 _checkFunctionParameters(element); |
| 111 } | 111 } |
| 112 | 112 |
| 113 if (!element.isClass) return; | 113 if (!element.isClass) return; |
| 114 | 114 |
| 115 ClassElement classElement = element; | 115 ClassElement classElement = element; |
| 116 | 116 |
| 117 // Skip classes that are completely unreachable. This should only happen | 117 // Skip classes that are completely unreachable. This should only happen |
| 118 // when all of jsinterop types are unreachable from main. | 118 // when all of jsinterop types are unreachable from main. |
| 119 if (!backend.compiler.closedWorld.isImplemented(classElement)) return; | 119 if (!backend.compiler.openWorld.isImplemented(classElement)) return; |
| 120 | 120 |
| 121 if (!classElement.implementsInterface(helpers.jsJavaScriptObjectClass)) { | 121 if (!classElement.implementsInterface(helpers.jsJavaScriptObjectClass)) { |
| 122 backend.reporter.reportErrorMessage(classElement, | 122 backend.reporter.reportErrorMessage(classElement, |
| 123 MessageKind.JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, { | 123 MessageKind.JS_INTEROP_CLASS_CANNOT_EXTEND_DART_CLASS, { |
| 124 'cls': classElement.name, | 124 'cls': classElement.name, |
| 125 'superclass': classElement.superclass.name | 125 'superclass': classElement.superclass.name |
| 126 }); | 126 }); |
| 127 } | 127 } |
| 128 | 128 |
| 129 classElement.forEachMember((ClassElement classElement, Element member) { | 129 classElement.forEachMember((ClassElement classElement, Element member) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 } | 188 } |
| 189 | 189 |
| 190 FunctionType buildJsFunctionType() { | 190 FunctionType buildJsFunctionType() { |
| 191 // TODO(jacobr): consider using codegenWorld.isChecks to determine the | 191 // TODO(jacobr): consider using codegenWorld.isChecks to determine the |
| 192 // range of positional arguments that need to be supported by JavaScript | 192 // range of positional arguments that need to be supported by JavaScript |
| 193 // function types. | 193 // function types. |
| 194 return new FunctionType.synthesized(const DynamicType(), [], | 194 return new FunctionType.synthesized(const DynamicType(), [], |
| 195 new List<DartType>.filled(16, const DynamicType())); | 195 new List<DartType>.filled(16, const DynamicType())); |
| 196 } | 196 } |
| 197 } | 197 } |
| OLD | NEW |