| 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 #library('js_helper'); | 5 #library('js_helper'); |
| 6 | 6 |
| 7 #import('coreimpl.dart'); | 7 #import('coreimpl.dart'); |
| 8 | 8 |
| 9 #source('constant_map.dart'); | 9 #source('constant_map.dart'); |
| 10 #source('date_helper.dart'); | 10 #source('date_helper.dart'); |
| (...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 } | 1309 } |
| 1310 | 1310 |
| 1311 /** | 1311 /** |
| 1312 * Called by generated code to fetch the stack trace from an | 1312 * Called by generated code to fetch the stack trace from an |
| 1313 * exception. | 1313 * exception. |
| 1314 */ | 1314 */ |
| 1315 StackTrace getTraceFromException(exception) { | 1315 StackTrace getTraceFromException(exception) { |
| 1316 return new StackTrace(JS("var", @"$0.stack", exception)); | 1316 return new StackTrace(JS("var", @"$0.stack", exception)); |
| 1317 } | 1317 } |
| 1318 | 1318 |
| 1319 class StackTrace { |
| 1320 var stack; |
| 1321 StackTrace(this.stack); |
| 1322 String toString() => stack != null ? stack : ''; |
| 1323 } |
| 1324 |
| 1325 |
| 1319 /** | 1326 /** |
| 1320 * Called by generated code to build a map literal. [keyValuePairs] is | 1327 * Called by generated code to build a map literal. [keyValuePairs] is |
| 1321 * a list of key, value, key, value, ..., etc. | 1328 * a list of key, value, key, value, ..., etc. |
| 1322 */ | 1329 */ |
| 1323 makeLiteralMap(List keyValuePairs) { | 1330 makeLiteralMap(List keyValuePairs) { |
| 1324 Iterator iterator = keyValuePairs.iterator(); | 1331 Iterator iterator = keyValuePairs.iterator(); |
| 1325 Map result = new LinkedHashMap(); | 1332 Map result = new LinkedHashMap(); |
| 1326 while (iterator.hasNext()) { | 1333 while (iterator.hasNext()) { |
| 1327 String key = iterator.next(); | 1334 String key = iterator.next(); |
| 1328 var value = iterator.next(); | 1335 var value = iterator.next(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1357 return function; | 1364 return function; |
| 1358 } | 1365 } |
| 1359 | 1366 |
| 1360 /** | 1367 /** |
| 1361 * Helper methods when converting a Dart closure to a JS closure. | 1368 * Helper methods when converting a Dart closure to a JS closure. |
| 1362 */ | 1369 */ |
| 1363 callClosure0(closure) => closure(); | 1370 callClosure0(closure) => closure(); |
| 1364 callClosure1(closure, arg1) => closure(arg1); | 1371 callClosure1(closure, arg1) => closure(arg1); |
| 1365 callClosure2(closure, arg1, arg2) => closure(arg1, arg2); | 1372 callClosure2(closure, arg1, arg2) => closure(arg1, arg2); |
| 1366 | 1373 |
| 1367 class StackTrace { | 1374 /** |
| 1368 var stack; | 1375 * Super class for Dart closures. |
| 1369 StackTrace(this.stack); | 1376 */ |
| 1370 String toString() => stack != null ? stack : ''; | 1377 class Closure implements Function { |
| 1378 String toString() => "Closure"; |
| 1371 } | 1379 } |
| 1372 | 1380 |
| 1373 bool jsHasOwnProperty(var jsObject, String property) { | 1381 bool jsHasOwnProperty(var jsObject, String property) { |
| 1374 return JS('bool', @'$0.hasOwnProperty($1)', jsObject, property); | 1382 return JS('bool', @'$0.hasOwnProperty($1)', jsObject, property); |
| 1375 } | 1383 } |
| 1376 | 1384 |
| 1377 jsPropertyAccess(var jsObject, String property) { | 1385 jsPropertyAccess(var jsObject, String property) { |
| 1378 return JS('var', @'$0[$1]', jsObject, property); | 1386 return JS('var', @'$0[$1]', jsObject, property); |
| 1379 } | 1387 } |
| OLD | NEW |