| 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 '../constants/values.dart' |
| 9 show ConstantValue, ConstructedConstantValue, StringConstantValue; |
| 8 import '../diagnostics/messages.dart' show MessageKind; | 10 import '../diagnostics/messages.dart' show MessageKind; |
| 9 import '../constants/values.dart' | |
| 10 show | |
| 11 ConstantValue, | |
| 12 ConstructedConstantValue, | |
| 13 ListConstantValue, | |
| 14 NullConstantValue, | |
| 15 StringConstantValue, | |
| 16 TypeConstantValue; | |
| 17 import '../elements/elements.dart' | 11 import '../elements/elements.dart' |
| 18 show | 12 show |
| 19 ClassElement, | 13 ClassElement, |
| 20 Element, | 14 Element, |
| 21 FieldElement, | 15 FieldElement, |
| 22 FunctionElement, | 16 FunctionElement, |
| 23 LibraryElement, | 17 LibraryElement, |
| 24 ParameterElement, | 18 ParameterElement, |
| 25 MetadataAnnotation; | 19 MetadataAnnotation; |
| 26 | |
| 27 import '../js/js.dart' as jsAst; | 20 import '../js/js.dart' as jsAst; |
| 28 import '../js/js.dart' show js; | 21 import '../js/js.dart' show js; |
| 29 import '../universe/selector.dart' show Selector; | 22 import '../universe/selector.dart' show Selector; |
| 30 import '../universe/universe.dart' show SelectorConstraints; | 23 import '../universe/universe.dart' show SelectorConstraints; |
| 31 | |
| 32 import 'backend_helpers.dart' show BackendHelpers; | 24 import 'backend_helpers.dart' show BackendHelpers; |
| 33 import 'js_backend.dart' show JavaScriptBackend; | 25 import 'js_backend.dart' show JavaScriptBackend; |
| 34 | 26 |
| 35 class JsInteropAnalysis { | 27 class JsInteropAnalysis { |
| 36 final JavaScriptBackend backend; | 28 final JavaScriptBackend backend; |
| 37 | 29 |
| 38 /// The resolved [FieldElement] for `Js.name`. | 30 /// The resolved [FieldElement] for `Js.name`. |
| 39 FieldElement nameField; | 31 FieldElement nameField; |
| 40 bool enabledJsInterop = false; | 32 bool enabledJsInterop = false; |
| 41 | 33 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 var name = backend.namer.invocationName(selector); | 176 var name = backend.namer.invocationName(selector); |
| 185 statements.add(js.statement( | 177 statements.add(js.statement( |
| 186 'Function.prototype.# = function(#) { return this(#) }', | 178 'Function.prototype.# = function(#) { return this(#) }', |
| 187 [name, parameters, parameters])); | 179 [name, parameters, parameters])); |
| 188 } | 180 } |
| 189 }); | 181 }); |
| 190 }); | 182 }); |
| 191 return new jsAst.Block(statements); | 183 return new jsAst.Block(statements); |
| 192 } | 184 } |
| 193 } | 185 } |
| OLD | NEW |