| 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 library _js_helper; | 5 library _js_helper; |
| 6 | 6 |
| 7 import 'dart:_js_embedded_names' show | 7 import 'dart:_js_embedded_names' show |
| 8 ALL_CLASSES, | 8 ALL_CLASSES, |
| 9 GET_ISOLATE_TAG, | 9 GET_ISOLATE_TAG, |
| 10 INTERCEPTED_NAMES, | 10 INTERCEPTED_NAMES, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 /// Marks the internal map in dart2js, so that internal libraries can is-check | 86 /// Marks the internal map in dart2js, so that internal libraries can is-check |
| 87 // them. | 87 // them. |
| 88 abstract class InternalMap { | 88 abstract class InternalMap { |
| 89 } | 89 } |
| 90 | 90 |
| 91 /// No-op method that is called to inform the compiler that preambles might | 91 /// No-op method that is called to inform the compiler that preambles might |
| 92 /// be needed when executing the resulting JS file in a command-line | 92 /// be needed when executing the resulting JS file in a command-line |
| 93 /// JS engine. | 93 /// JS engine. |
| 94 requiresPreamble() {} | 94 requiresPreamble() {} |
| 95 | 95 |
| 96 bool isJsIndexable(var object, var record) { | |
| 97 if (record != null) { | |
| 98 var result = dispatchRecordIndexability(record); | |
| 99 if (result != null) return result; | |
| 100 } | |
| 101 return object is JavaScriptIndexingBehavior; | |
| 102 } | |
| 103 | |
| 104 String S(value) { | 96 String S(value) { |
| 105 if (value is String) return value; | 97 if (value is String) return value; |
| 106 if (value is num) { | 98 if (value is num) { |
| 107 if (value != 0) { | 99 if (value != 0) { |
| 108 // ""+x is faster than String(x) for integers on most browsers. | 100 // ""+x is faster than String(x) for integers on most browsers. |
| 109 return JS('String', r'"" + (#)', value); | 101 return JS('String', r'"" + (#)', value); |
| 110 } | 102 } |
| 111 } else if (true == value) { | 103 } else if (true == value) { |
| 112 return 'true'; | 104 return 'true'; |
| 113 } else if (false == value) { | 105 } else if (false == value) { |
| (...skipping 3345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3459 throw new MainError("No top-level function named 'main'."); | 3451 throw new MainError("No top-level function named 'main'."); |
| 3460 } | 3452 } |
| 3461 | 3453 |
| 3462 void badMain() { | 3454 void badMain() { |
| 3463 throw new MainError("'main' is not a function."); | 3455 throw new MainError("'main' is not a function."); |
| 3464 } | 3456 } |
| 3465 | 3457 |
| 3466 void mainHasTooManyParameters() { | 3458 void mainHasTooManyParameters() { |
| 3467 throw new MainError("'main' expects too many parameters."); | 3459 throw new MainError("'main' expects too many parameters."); |
| 3468 } | 3460 } |
| OLD | NEW |