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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 if (_jsKeywords == null) { | 326 if (_jsKeywords == null) { |
327 // TODO(jmesserly): this doesn't work if I write "new Set<String>.from" | 327 // TODO(jmesserly): this doesn't work if I write "new Set<String>.from" |
328 // List of JS reserved words. | 328 // List of JS reserved words. |
329 _jsKeywords = new Set.from([ | 329 _jsKeywords = new Set.from([ |
330 'break', 'case', 'catch', 'continue', 'debugger', 'default', | 330 'break', 'case', 'catch', 'continue', 'debugger', 'default', |
331 'delete', 'do', 'else', 'finally', 'for', 'function', 'if', | 331 'delete', 'do', 'else', 'finally', 'for', 'function', 'if', |
332 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw', | 332 'in', 'instanceof', 'new', 'return', 'switch', 'this', 'throw', |
333 'try', 'typeof', 'var', 'void', 'while', 'with', | 333 'try', 'typeof', 'var', 'void', 'while', 'with', |
334 'class', 'enum', 'export', 'extends', 'import', 'super', | 334 'class', 'enum', 'export', 'extends', 'import', 'super', |
335 'implements', 'interface', 'let', 'package', 'private', | 335 'implements', 'interface', 'let', 'package', 'private', |
336 'protected', 'public', 'static', 'yield', | 336 'protected', 'public', 'static', 'yield', 'native']); |
337 // Hack: we don't want Dart's String.split to overwrite the existing | |
338 // JS String.split method. By adding 'split' to the keyword-set we | |
339 // ensure that frog will not use the 'split' name but mangle it, thus | |
340 // leaving the original JS String.split untouched. | |
341 'split', | |
ngeoffray
2012/02/29 08:26:43
Is this just for making this list what it actually
kasperl
2012/02/29 08:35:44
Yes. I just moved the hack and made it a bit more
| |
342 'native']); | |
343 } | 337 } |
344 if (_jsKeywords.contains(name)) { | 338 if (_jsKeywords.contains(name)) { |
345 return name + '_'; | 339 return name + '_'; |
346 } else { | 340 } else { |
347 // regexs for better perf? | 341 // regexs for better perf? |
348 return name.replaceAll(@'$', @'$$').replaceAll(':', @'$'); | 342 return name.replaceAll(@'$', @'$$').replaceAll(':', @'$'); |
349 } | 343 } |
350 } | 344 } |
351 | 345 |
352 /** | 346 /** |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
634 | 628 |
635 withTiming(String name, f()) { | 629 withTiming(String name, f()) { |
636 final sw = new Stopwatch(); | 630 final sw = new Stopwatch(); |
637 sw.start(); | 631 sw.start(); |
638 var result = f(); | 632 var result = f(); |
639 sw.stop(); | 633 sw.stop(); |
640 info('$name in ${sw.elapsedInMs()}msec'); | 634 info('$name in ${sw.elapsedInMs()}msec'); |
641 return result; | 635 return result; |
642 } | 636 } |
643 } | 637 } |
OLD | NEW |