OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 part of dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
6 | 6 |
7 class ClassStubGenerator { | 7 class ClassStubGenerator { |
8 final Namer namer; | 8 final Namer namer; |
9 final Compiler compiler; | 9 final Compiler compiler; |
10 final JavaScriptBackend backend; | 10 final JavaScriptBackend backend; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 /// Each function must have the `$callName` property set. | 199 /// Each function must have the `$callName` property set. |
200 /// * `reflectionInfo`: contains reflective information, and the function | 200 /// * `reflectionInfo`: contains reflective information, and the function |
201 /// type. TODO(floitsch): point to where this is specified. | 201 /// type. TODO(floitsch): point to where this is specified. |
202 /// * `isStatic`. | 202 /// * `isStatic`. |
203 /// * `name`. | 203 /// * `name`. |
204 /// * `isIntercepted. | 204 /// * `isIntercepted. |
205 List<jsAst.Statement> buildTearOffCode(JavaScriptBackend backend) { | 205 List<jsAst.Statement> buildTearOffCode(JavaScriptBackend backend) { |
206 Namer namer = backend.namer; | 206 Namer namer = backend.namer; |
207 Compiler compiler = backend.compiler; | 207 Compiler compiler = backend.compiler; |
208 | 208 |
209 Element closureFromTearOff = backend.findHelper('closureFromTearOff'); | 209 Element closureFromTearOff = backend.helpers.closureFromTearOff; |
210 jsAst.Expression tearOffAccessExpression; | 210 jsAst.Expression tearOffAccessExpression; |
211 jsAst.Expression tearOffGlobalObjectString; | 211 jsAst.Expression tearOffGlobalObjectString; |
212 jsAst.Expression tearOffGlobalObject; | 212 jsAst.Expression tearOffGlobalObject; |
213 if (closureFromTearOff != null) { | 213 if (closureFromTearOff != null) { |
214 tearOffAccessExpression = | 214 tearOffAccessExpression = |
215 backend.emitter.staticFunctionAccess(closureFromTearOff); | 215 backend.emitter.staticFunctionAccess(closureFromTearOff); |
216 tearOffGlobalObject = | 216 tearOffGlobalObject = |
217 js.stringPart(namer.globalObjectFor(closureFromTearOff)); | 217 js.stringPart(namer.globalObjectFor(closureFromTearOff)); |
218 tearOffGlobalObjectString = | 218 tearOffGlobalObjectString = |
219 js.string(namer.globalObjectFor(closureFromTearOff)); | 219 js.string(namer.globalObjectFor(closureFromTearOff)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 ? function() { | 275 ? function() { |
276 if (cache === void 0) cache = #tearOff( | 276 if (cache === void 0) cache = #tearOff( |
277 this, funcs, reflectionInfo, true, [], name).prototype; | 277 this, funcs, reflectionInfo, true, [], name).prototype; |
278 return cache; | 278 return cache; |
279 } | 279 } |
280 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); | 280 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); |
281 }''', {'tearOff': tearOffAccessExpression}); | 281 }''', {'tearOff': tearOffAccessExpression}); |
282 | 282 |
283 return <jsAst.Statement>[tearOffGetter, tearOff]; | 283 return <jsAst.Statement>[tearOffGetter, tearOff]; |
284 } | 284 } |
OLD | NEW |