| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A function element that represents a closure call. The signature is copied | 8 * A function element that represents a closure call. The signature is copied |
| 9 * from the given element. | 9 * from the given element. |
| 10 */ | 10 */ |
| (...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2379 | 2379 |
| 2380 jsAst.Expression isNotObject(String variable) { | 2380 jsAst.Expression isNotObject(String variable) { |
| 2381 return js[variable].typeof.equals(js.string('object')).not; | 2381 return js[variable].typeof.equals(js.string('object')).not; |
| 2382 } | 2382 } |
| 2383 | 2383 |
| 2384 jsAst.Expression isInt(String variable) { | 2384 jsAst.Expression isInt(String variable) { |
| 2385 jsAst.Expression receiver = js[variable]; | 2385 jsAst.Expression receiver = js[variable]; |
| 2386 return isNumber(variable).binary('&&', | 2386 return isNumber(variable).binary('&&', |
| 2387 js['Math']['floor'](receiver).equals(receiver)); | 2387 js['Math']['floor'](receiver).equals(receiver)); |
| 2388 } | 2388 } |
| 2389 | 2389 |
| 2390 jsAst.Expression tripleShiftZero(jsAst.Expression receiver) { | 2390 jsAst.Expression tripleShiftZero(jsAst.Expression receiver) { |
| 2391 return receiver.binary('>>>', js.toExpression(0)); | 2391 return receiver.binary('>>>', js.toExpression(0)); |
| 2392 } | 2392 } |
| 2393 | 2393 |
| 2394 if (selector.isOperator()) { | 2394 if (selector.isOperator()) { |
| 2395 String name = selector.name.stringValue; | 2395 String name = selector.name.stringValue; |
| 2396 if (name == '==') { | 2396 if (name == '==') { |
| 2397 // Unfolds to: | 2397 // Unfolds to: |
| 2398 // [: if (receiver == null) return a0 == null; | 2398 // [: if (receiver == null) return a0 == null; |
| 2399 // if (typeof receiver != 'object') { | 2399 // if (typeof receiver != 'object') { |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2706 """; | 2706 """; |
| 2707 const String HOOKS_API_USAGE = """ | 2707 const String HOOKS_API_USAGE = """ |
| 2708 // The code supports the following hooks: | 2708 // The code supports the following hooks: |
| 2709 // dartPrint(message) - if this function is defined it is called | 2709 // dartPrint(message) - if this function is defined it is called |
| 2710 // instead of the Dart [print] method. | 2710 // instead of the Dart [print] method. |
| 2711 // dartMainRunner(main) - if this function is defined, the Dart [main] | 2711 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 2712 // method will not be invoked directly. | 2712 // method will not be invoked directly. |
| 2713 // Instead, a closure that will invoke [main] is | 2713 // Instead, a closure that will invoke [main] is |
| 2714 // passed to [dartMainRunner]. | 2714 // passed to [dartMainRunner]. |
| 2715 """; | 2715 """; |
| OLD | NEW |