| 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 27 matching lines...) Expand all Loading... |
| 38 bool _inCodegen = false; | 38 bool _inCodegen = false; |
| 39 | 39 |
| 40 JsInteropAnalysis(this.backend); | 40 JsInteropAnalysis(this.backend); |
| 41 | 41 |
| 42 BackendHelpers get helpers => backend.helpers; | 42 BackendHelpers get helpers => backend.helpers; |
| 43 | 43 |
| 44 void onQueueClosed() { | 44 void onQueueClosed() { |
| 45 if (_inCodegen) return; | 45 if (_inCodegen) return; |
| 46 | 46 |
| 47 if (helpers.jsAnnotationClass != null) { | 47 if (helpers.jsAnnotationClass != null) { |
| 48 nameField = helpers.jsAnnotationClass.lookupMember('name'); | 48 ClassElement cls = helpers.jsAnnotationClass; |
| 49 nameField = cls.lookupMember('name'); |
| 49 backend.compiler.libraryLoader.libraries | 50 backend.compiler.libraryLoader.libraries |
| 50 .forEach(processJsInteropAnnotationsInLibrary); | 51 .forEach(processJsInteropAnnotationsInLibrary); |
| 51 } | 52 } |
| 52 } | 53 } |
| 53 | 54 |
| 54 void onCodegenStart() { | 55 void onCodegenStart() { |
| 55 _inCodegen = true; | 56 _inCodegen = true; |
| 56 } | 57 } |
| 57 | 58 |
| 58 void processJsInteropAnnotation(Element e) { | 59 void processJsInteropAnnotation(Element e) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 ResolutionFunctionType buildJsFunctionType() { | 195 ResolutionFunctionType buildJsFunctionType() { |
| 195 // TODO(jacobr): consider using codegenWorldBuilder.isChecks to determine th
e | 196 // TODO(jacobr): consider using codegenWorldBuilder.isChecks to determine th
e |
| 196 // range of positional arguments that need to be supported by JavaScript | 197 // range of positional arguments that need to be supported by JavaScript |
| 197 // function types. | 198 // function types. |
| 198 return new ResolutionFunctionType.synthesized( | 199 return new ResolutionFunctionType.synthesized( |
| 199 const ResolutionDynamicType(), | 200 const ResolutionDynamicType(), |
| 200 [], | 201 [], |
| 201 new List<ResolutionDartType>.filled(16, const ResolutionDynamicType())); | 202 new List<ResolutionDartType>.filled(16, const ResolutionDynamicType())); |
| 202 } | 203 } |
| 203 } | 204 } |
| OLD | NEW |