Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // TODO(ahe): Share these with js_helper.dart. | 7 // TODO(ahe): Share these with js_helper.dart. |
| 8 const FUNCTION_INDEX = 0; | 8 const FUNCTION_INDEX = 0; |
| 9 const NAME_INDEX = 1; | 9 const NAME_INDEX = 1; |
| 10 const CALL_NAME_INDEX = 2; | 10 const CALL_NAME_INDEX = 2; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 Compiler compiler = backend.compiler; | 311 Compiler compiler = backend.compiler; |
| 312 | 312 |
| 313 Element closureFromTearOff = backend.findHelper('closureFromTearOff'); | 313 Element closureFromTearOff = backend.findHelper('closureFromTearOff'); |
| 314 String tearOffAccessText; | 314 String tearOffAccessText; |
| 315 jsAst.Expression tearOffAccessExpression; | 315 jsAst.Expression tearOffAccessExpression; |
| 316 String tearOffGlobalObjectName; | 316 String tearOffGlobalObjectName; |
| 317 String tearOffGlobalObject; | 317 String tearOffGlobalObject; |
| 318 if (closureFromTearOff != null) { | 318 if (closureFromTearOff != null) { |
| 319 // We need both the AST that references [closureFromTearOff] and a string | 319 // We need both the AST that references [closureFromTearOff] and a string |
| 320 // for the NoCsp version that constructs a function. | 320 // for the NoCsp version that constructs a function. |
| 321 tearOffAccessExpression = namer.elementAccess(closureFromTearOff); | 321 tearOffAccessExpression = |
| 322 backend.emitter.globalPropertyAccess(closureFromTearOff); | |
|
floitsch
2014/12/03 17:02:25
staticFunctionAccess
zarah
2014/12/05 08:22:51
Done.
| |
| 322 tearOffAccessText = | 323 tearOffAccessText = |
| 323 jsAst.prettyPrint(tearOffAccessExpression, compiler).getText(); | 324 jsAst.prettyPrint(tearOffAccessExpression, compiler).getText(); |
| 324 tearOffGlobalObjectName = tearOffGlobalObject = | 325 tearOffGlobalObjectName = tearOffGlobalObject = |
| 325 namer.globalObjectFor(closureFromTearOff); | 326 namer.globalObjectFor(closureFromTearOff); |
| 326 } else { | 327 } else { |
| 327 // Default values for mocked-up test libraries. | 328 // Default values for mocked-up test libraries. |
| 328 tearOffAccessText = | 329 tearOffAccessText = |
| 329 r'''function() { throw 'Helper \'closureFromTearOff\' missing.' }'''; | 330 r'''function() { throw 'Helper \'closureFromTearOff\' missing.' }'''; |
| 330 tearOffAccessExpression = js(tearOffAccessText); | 331 tearOffAccessExpression = js(tearOffAccessText); |
| 331 tearOffGlobalObjectName = 'MissingHelperFunction'; | 332 tearOffGlobalObjectName = 'MissingHelperFunction'; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 (function() { | 415 (function() { |
| 415 var result = $array[$index]; | 416 var result = $array[$index]; |
| 416 if ($check) { | 417 if ($check) { |
| 417 throw new Error( | 418 throw new Error( |
| 418 name + ": expected value of type \'$type\' at index " + ($index) + | 419 name + ": expected value of type \'$type\' at index " + ($index) + |
| 419 " but got " + (typeof result)); | 420 " but got " + (typeof result)); |
| 420 } | 421 } |
| 421 return result; | 422 return result; |
| 422 })()'''; | 423 })()'''; |
| 423 } | 424 } |
| OLD | NEW |