Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/js_helper.dart

Issue 781223002: Simplify dart2js StringBuffer constructor to be initializer-only. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add type to flattenString to improve type inference Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/core_patch.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'shared/embedded_names.dart' show 7 import 'shared/embedded_names.dart' show
8 ALL_CLASSES, 8 ALL_CLASSES,
9 GET_ISOLATE_TAG, 9 GET_ISOLATE_TAG,
10 INTERCEPTED_NAMES, 10 INTERCEPTED_NAMES,
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 } 819 }
820 } 820 }
821 throw new RangeError.range(charCode, 0, 0x10ffff); 821 throw new RangeError.range(charCode, 0, 0x10ffff);
822 } 822 }
823 823
824 static String stringConcatUnchecked(String string1, String string2) { 824 static String stringConcatUnchecked(String string1, String string2) {
825 return JS_STRING_CONCAT(string1, string2); 825 return JS_STRING_CONCAT(string1, string2);
826 } 826 }
827 827
828 static String flattenString(String str) { 828 static String flattenString(String str) {
829 return JS('', "#.charCodeAt(0) == 0 ? # : #", str, str, str); 829 return JS('String', "#.charCodeAt(0) == 0 ? # : #", str, str, str);
830 } 830 }
831 831
832 static String getTimeZoneName(receiver) { 832 static String getTimeZoneName(receiver) {
833 // Firefox and Chrome emit the timezone in parenthesis. 833 // Firefox and Chrome emit the timezone in parenthesis.
834 // Example: "Wed May 16 2012 21:13:00 GMT+0200 (CEST)". 834 // Example: "Wed May 16 2012 21:13:00 GMT+0200 (CEST)".
835 // We extract this name using a regexp. 835 // We extract this name using a regexp.
836 var d = lazyAsJsDate(receiver); 836 var d = lazyAsJsDate(receiver);
837 List match = JS('JSArray|Null', r'/\((.*)\)/.exec(#.toString())', d); 837 List match = JS('JSArray|Null', r'/\((.*)\)/.exec(#.toString())', d);
838 if (match != null) return match[1]; 838 if (match != null) return match[1];
839 839
(...skipping 2568 matching lines...) Expand 10 before | Expand all | Expand 10 after
3408 throw new MainError("No top-level function named 'main'."); 3408 throw new MainError("No top-level function named 'main'.");
3409 } 3409 }
3410 3410
3411 void badMain() { 3411 void badMain() {
3412 throw new MainError("'main' is not a function."); 3412 throw new MainError("'main' is not a function.");
3413 } 3413 }
3414 3414
3415 void mainHasTooManyParameters() { 3415 void mainHasTooManyParameters() {
3416 throw new MainError("'main' expects too many parameters."); 3416 throw new MainError("'main' expects too many parameters.");
3417 } 3417 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/core_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698