Chromium Code Reviews| 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 /** The one true [World]. */ | 5 /** The one true [World]. */ |
| 6 World world; | 6 World world; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Experimental phase to enable await, only set when using the | 9 * Experimental phase to enable await, only set when using the |
| 10 * await/awaitc.dart entrypoint. | 10 * await/awaitc.dart entrypoint. |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 // TODO(jmesserly): this doesn't work if I write "new Set<String>.from" | 323 // TODO(jmesserly): this doesn't work if I write "new Set<String>.from" |
| 324 // List of JS reserved words. | 324 // List of JS reserved words. |
| 325 _jsKeywords = new Set.from([ | 325 _jsKeywords = new Set.from([ |
| 326 'break', 'case', 'catch', 'continue', 'debugger', 'default', | 326 'break', 'case', 'catch', 'continue', 'debugger', 'default', |
| 327 'delete', 'do', 'else', 'finally', 'for', 'function', 'if', | 327 'delete', 'do', 'else', 'finally', 'for', 'function', 'if', |
| 328 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw', | 328 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw', |
| 329 'try', 'typeof', 'var', 'void', 'while', 'with', | 329 'try', 'typeof', 'var', 'void', 'while', 'with', |
| 330 'class', 'enum', 'export', 'extends', 'import', 'super', | 330 'class', 'enum', 'export', 'extends', 'import', 'super', |
| 331 'implements', 'interface', 'let', 'package', 'private', | 331 'implements', 'interface', 'let', 'package', 'private', |
| 332 'protected', 'public', 'static', 'yield', | 332 'protected', 'public', 'static', 'yield', |
| 333 // Hack: we don't want Dart's String.split to overwrite the existing | |
|
kasperl
2012/02/07 12:32:30
Maybe explain this a bit better. Elaborate.
floitsch
2012/02/07 15:06:29
Done.
| |
| 334 // split method. | |
| 335 'split', | |
| 333 'native']); | 336 'native']); |
| 334 } | 337 } |
| 335 if (_jsKeywords.contains(name)) { | 338 if (_jsKeywords.contains(name)) { |
| 336 return name + '_'; | 339 return name + '_'; |
| 337 } else { | 340 } else { |
| 338 // regexs for better perf? | 341 // regexs for better perf? |
| 339 return name.replaceAll(@'$', @'$$').replaceAll(':', @'$'); | 342 return name.replaceAll(@'$', @'$$').replaceAll(':', @'$'); |
| 340 } | 343 } |
| 341 } | 344 } |
| 342 | 345 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 619 | 622 |
| 620 withTiming(String name, f()) { | 623 withTiming(String name, f()) { |
| 621 final sw = new Stopwatch(); | 624 final sw = new Stopwatch(); |
| 622 sw.start(); | 625 sw.start(); |
| 623 var result = f(); | 626 var result = f(); |
| 624 sw.stop(); | 627 sw.stop(); |
| 625 info('$name in ${sw.elapsedInMs()}msec'); | 628 info('$name in ${sw.elapsedInMs()}msec'); |
| 626 return result; | 629 return result; |
| 627 } | 630 } |
| 628 } | 631 } |
| OLD | NEW |