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

Side by Side Diff: lib/runtime/dart/_js_helper.js

Issue 1348453004: fix some errors in our SDK, mostly around numbers (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 3 months 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
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/_native_typed_data.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('dart/_js_helper', null, /* Imports */[ 1 dart_library.library('dart/_js_helper', null, /* Imports */[
2 "dart_runtime/dart", 2 "dart_runtime/dart",
3 'dart/core', 3 'dart/core',
4 'dart/collection', 4 'dart/collection',
5 'dart/_interceptors', 5 'dart/_interceptors',
6 'dart/_foreign_helper' 6 'dart/_foreign_helper'
7 ], /* Lazy imports */[ 7 ], /* Lazy imports */[
8 ], function(exports, dart, core, collection, _interceptors, _foreign_helper) { 8 ], function(exports, dart, core, collection, _interceptors, _foreign_helper) {
9 'use strict'; 9 'use strict';
10 let dartx = dart.dartx; 10 let dartx = dart.dartx;
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 return result; 687 return result;
688 } 688 }
689 static stringFromCodePoints(codePoints) { 689 static stringFromCodePoints(codePoints) {
690 let a = dart.list([], core.int); 690 let a = dart.list([], core.int);
691 for (let i of dart.as(codePoints, core.Iterable)) { 691 for (let i of dart.as(codePoints, core.Iterable)) {
692 if (!(typeof i == 'number')) 692 if (!(typeof i == 'number'))
693 dart.throw(new core.ArgumentError(i)); 693 dart.throw(new core.ArgumentError(i));
694 if (dart.notNull(dart.as(dart.dsend(i, '<=', 65535), core.bool))) { 694 if (dart.notNull(dart.as(dart.dsend(i, '<=', 65535), core.bool))) {
695 a[dartx.add](dart.as(i, core.int)); 695 a[dartx.add](dart.as(i, core.int));
696 } else if (dart.notNull(dart.as(dart.dsend(i, '<=', 1114111), core.bool) )) { 696 } else if (dart.notNull(dart.as(dart.dsend(i, '<=', 1114111), core.bool) )) {
697 a[dartx.add]((55296)[dartx['+']](dart.as(dart.dsend(dart.dsend(dart.ds end(i, '-', 65536), '>>', 10), '&', 1023), core.num))); 697 a[dartx.add](dart.asInt((55296)[dartx['+']](dart.as(dart.dsend(dart.ds end(dart.dsend(i, '-', 65536), '>>', 10), '&', 1023), core.num))));
698 a[dartx.add]((56320)[dartx['+']](dart.as(dart.dsend(i, '&', 1023), cor e.num))); 698 a[dartx.add](dart.asInt((56320)[dartx['+']](dart.as(dart.dsend(i, '&', 1023), core.num))));
699 } else { 699 } else {
700 dart.throw(new core.ArgumentError(i)); 700 dart.throw(new core.ArgumentError(i));
701 } 701 }
702 } 702 }
703 return Primitives._fromCharCodeApply(a); 703 return Primitives._fromCharCodeApply(a);
704 } 704 }
705 static stringFromCharCodes(charCodes) { 705 static stringFromCharCodes(charCodes) {
706 for (let i of dart.as(charCodes, core.Iterable)) { 706 for (let i of dart.as(charCodes, core.Iterable)) {
707 if (!(typeof i == 'number')) 707 if (!(typeof i == 'number'))
708 dart.throw(new core.ArgumentError(i)); 708 dart.throw(new core.ArgumentError(i));
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 } 815 }
816 static valueFromDateString(str) { 816 static valueFromDateString(str) {
817 if (!(typeof str == 'string')) 817 if (!(typeof str == 'string'))
818 dart.throw(new core.ArgumentError(str)); 818 dart.throw(new core.ArgumentError(str));
819 let value = Date.parse(str); 819 let value = Date.parse(str);
820 if (dart.notNull(value[dartx.isNaN])) 820 if (dart.notNull(value[dartx.isNaN]))
821 dart.throw(new core.ArgumentError(str)); 821 dart.throw(new core.ArgumentError(str));
822 return value; 822 return value;
823 } 823 }
824 static getProperty(object, key) { 824 static getProperty(object, key) {
825 if (object == null || typeof object == 'boolean' || dart.is(object, core.n um) || typeof object == 'string') { 825 if (object == null || typeof object == 'boolean' || typeof object == 'numb er' || typeof object == 'string') {
826 dart.throw(new core.ArgumentError(object)); 826 dart.throw(new core.ArgumentError(object));
827 } 827 }
828 return object[key]; 828 return object[key];
829 } 829 }
830 static setProperty(object, key, value) { 830 static setProperty(object, key, value) {
831 if (object == null || typeof object == 'boolean' || dart.is(object, core.n um) || typeof object == 'string') { 831 if (object == null || typeof object == 'boolean' || typeof object == 'numb er' || typeof object == 'string') {
832 dart.throw(new core.ArgumentError(object)); 832 dart.throw(new core.ArgumentError(object));
833 } 833 }
834 object[key] = value; 834 object[key] = value;
835 } 835 }
836 static identicalImplementation(a, b) { 836 static identicalImplementation(a, b) {
837 return a == null ? b == null : a === b; 837 return a == null ? b == null : a === b;
838 } 838 }
839 static extractStackTrace(error) { 839 static extractStackTrace(error) {
840 return getTraceFromException(error.$thrownJsError); 840 return getTraceFromException(error.$thrownJsError);
841 } 841 }
842 } 842 }
843 dart.setSignature(Primitives, { 843 dart.setSignature(Primitives, {
844 statics: () => ({ 844 statics: () => ({
845 initializeStatics: [dart.void, [core.int]], 845 initializeStatics: [dart.void, [core.int]],
846 objectHashCode: [core.int, [dart.dynamic]], 846 objectHashCode: [core.int, [dart.dynamic]],
847 _throwFormatException: [dart.dynamic, [core.String]], 847 _throwFormatException: [dart.dynamic, [core.String]],
848 parseInt: [core.int, [core.String, core.int, dart.functionType(core.int, [ core.String])]], 848 parseInt: [core.int, [core.String, core.int, dart.functionType(core.int, [ core.String])]],
849 parseDouble: [core.double, [core.String, dart.functionType(core.double, [c ore.String])]], 849 parseDouble: [core.double, [core.String, dart.functionType(core.double, [c ore.String])]],
850 objectTypeName: [core.String, [core.Object]], 850 objectTypeName: [core.String, [core.Object]],
851 objectToString: [core.String, [core.Object]], 851 objectToString: [core.String, [core.Object]],
852 dateNow: [core.num, []], 852 dateNow: [core.int, []],
853 initTicker: [dart.void, []], 853 initTicker: [dart.void, []],
854 currentUri: [core.String, []], 854 currentUri: [core.String, []],
855 _fromCharCodeApply: [core.String, [core.List$(core.int)]], 855 _fromCharCodeApply: [core.String, [core.List$(core.int)]],
856 stringFromCodePoints: [core.String, [dart.dynamic]], 856 stringFromCodePoints: [core.String, [dart.dynamic]],
857 stringFromCharCodes: [core.String, [dart.dynamic]], 857 stringFromCharCodes: [core.String, [dart.dynamic]],
858 stringFromCharCode: [core.String, [dart.dynamic]], 858 stringFromCharCode: [core.String, [dart.dynamic]],
859 stringConcatUnchecked: [core.String, [core.String, core.String]], 859 stringConcatUnchecked: [core.String, [core.String, core.String]],
860 flattenString: [core.String, [core.String]], 860 flattenString: [core.String, [core.String]],
861 getTimeZoneName: [core.String, [dart.dynamic]], 861 getTimeZoneName: [core.String, [dart.dynamic]],
862 getTimeZoneOffsetInMinutes: [core.int, [dart.dynamic]], 862 getTimeZoneOffsetInMinutes: [core.int, [dart.dynamic]],
(...skipping 25 matching lines...) Expand all
888 return receiver.lastIndexOf(element, start); 888 return receiver.lastIndexOf(element, start);
889 } 889 }
890 dart.fn(stringLastIndexOfUnchecked); 890 dart.fn(stringLastIndexOfUnchecked);
891 function checkNull(object) { 891 function checkNull(object) {
892 if (object == null) 892 if (object == null)
893 dart.throw(new core.ArgumentError(null)); 893 dart.throw(new core.ArgumentError(null));
894 return object; 894 return object;
895 } 895 }
896 dart.fn(checkNull); 896 dart.fn(checkNull);
897 function checkNum(value) { 897 function checkNum(value) {
898 if (!dart.is(value, core.num)) { 898 if (!(typeof value == 'number')) {
899 dart.throw(new core.ArgumentError(value)); 899 dart.throw(new core.ArgumentError(value));
900 } 900 }
901 return value; 901 return value;
902 } 902 }
903 dart.fn(checkNum); 903 dart.fn(checkNum);
904 function checkInt(value) { 904 function checkInt(value) {
905 if (!(typeof value == 'number')) { 905 if (!(typeof value == 'number')) {
906 dart.throw(new core.ArgumentError(value)); 906 dart.throw(new core.ArgumentError(value));
907 } 907 }
908 return value; 908 return value;
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 exports.CastErrorImplementation = CastErrorImplementation; 1242 exports.CastErrorImplementation = CastErrorImplementation;
1243 exports.FallThroughErrorImplementation = FallThroughErrorImplementation; 1243 exports.FallThroughErrorImplementation = FallThroughErrorImplementation;
1244 exports.RuntimeError = RuntimeError; 1244 exports.RuntimeError = RuntimeError;
1245 exports.random64 = random64; 1245 exports.random64 = random64;
1246 exports.jsonEncodeNative = jsonEncodeNative; 1246 exports.jsonEncodeNative = jsonEncodeNative;
1247 exports.SyncIterator$ = SyncIterator$; 1247 exports.SyncIterator$ = SyncIterator$;
1248 exports.SyncIterator = SyncIterator; 1248 exports.SyncIterator = SyncIterator;
1249 exports.SyncIterable$ = SyncIterable$; 1249 exports.SyncIterable$ = SyncIterable$;
1250 exports.SyncIterable = SyncIterable; 1250 exports.SyncIterable = SyncIterable;
1251 }); 1251 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/_isolate_helper.js ('k') | lib/runtime/dart/_native_typed_data.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698