Chromium Code Reviews| 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; |
| 11 import '../dart_types.dart' | |
| 12 show | |
| 13 DartType, | |
| 14 DynamicType, | |
| 15 FunctionType; | |
| 11 import '../diagnostics/messages.dart' show MessageKind; | 16 import '../diagnostics/messages.dart' show MessageKind; |
| 12 import '../elements/elements.dart' | 17 import '../elements/elements.dart' |
| 13 show | 18 show |
| 14 ClassElement, | 19 ClassElement, |
| 15 Element, | 20 Element, |
| 16 FieldElement, | 21 FieldElement, |
| 17 FunctionElement, | 22 FunctionElement, |
| 18 LibraryElement, | 23 LibraryElement, |
| 19 ParameterElement, | 24 ParameterElement, |
| 20 MetadataAnnotation; | 25 MetadataAnnotation; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 | 183 |
| 179 var name = backend.namer.invocationName(selector); | 184 var name = backend.namer.invocationName(selector); |
| 180 statements.add(js.statement( | 185 statements.add(js.statement( |
| 181 'Function.prototype.# = function(#) { return this(#) }', | 186 'Function.prototype.# = function(#) { return this(#) }', |
| 182 [name, parameters, parameters])); | 187 [name, parameters, parameters])); |
| 183 } | 188 } |
| 184 }); | 189 }); |
| 185 }); | 190 }); |
| 186 return new jsAst.Block(statements); | 191 return new jsAst.Block(statements); |
| 187 } | 192 } |
| 193 | |
| 194 FunctionType buildJsFunctionType() { | |
| 195 // TODO(jacobr): consider using codegenWorld.isChecks to determine the | |
| 196 // range of positional arguments that need to be supported by JavaScript | |
| 197 // function types. | |
| 198 return new FunctionType.synthesized( | |
| 199 const DynamicType(), | |
| 200 [], | |
| 201 new List<DartType>.generate(16, (_) => const DynamicType())); | |
|
sra1
2016/06/30 17:57:13
This is ok since it is a one-of thing, but conside
Jacob
2016/07/01 18:27:50
filled is better. Forgot we had that constructor.
| |
| 202 } | |
| 188 } | 203 } |
| OLD | NEW |