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

Side by Side Diff: lib/runtime/_operations.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 | « no previous file | lib/runtime/dart/_interceptors.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 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /* This library defines runtime operations on objects used by the code 5 /* This library defines runtime operations on objects used by the code
6 * generator. 6 * generator.
7 */ 7 */
8 dart_library.library('dart_runtime/_operations', null, /* Imports */[ 8 dart_library.library('dart_runtime/_operations', null, /* Imports */[
9 ], /* Lazy Imports */[ 9 ], /* Lazy Imports */[
10 'dart/async', 10 'dart/async',
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 let actual = rtti.realRuntimeType(obj); 225 let actual = rtti.realRuntimeType(obj);
226 if (types.isGroundType(type)) errors.throwCastError(actual, type); 226 if (types.isGroundType(type)) errors.throwCastError(actual, type);
227 227
228 if (_ignoreTypeFailure(actual, type)) return obj; 228 if (_ignoreTypeFailure(actual, type)) return obj;
229 229
230 dart_utils.throwStrongModeError('Strong mode cast failure from ' + 230 dart_utils.throwStrongModeError('Strong mode cast failure from ' +
231 types.typeName(actual) + ' to ' + types.typeName(type)); 231 types.typeName(actual) + ' to ' + types.typeName(type));
232 } 232 }
233 exports.cast = cast; 233 exports.cast = cast;
234 234
235 function asInt(obj) {
236 if (Math.floor(obj) != obj) {
237 // Note: null will also be caught by this check
238 errors.throwCastError(rtti.realRuntimeType(obj), core.int);
239 }
240 return obj;
241 }
242 exports.asInt = asInt;
243
235 function arity(f) { 244 function arity(f) {
236 // TODO(jmesserly): need to parse optional params. 245 // TODO(jmesserly): need to parse optional params.
237 // In ES6, length is the number of required arguments. 246 // In ES6, length is the number of required arguments.
238 return { min: f.length, max: f.length }; 247 return { min: f.length, max: f.length };
239 } 248 }
240 exports.arity = arity; 249 exports.arity = arity;
241 250
242 function equals(x, y) { 251 function equals(x, y) {
243 if (x == null || y == null) return x == y; 252 if (x == null || y == null) return x == y;
244 let eq = x['==']; 253 let eq = x['=='];
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 next() { 457 next() {
449 let i = this.dartIterator; 458 let i = this.dartIterator;
450 let done = !i.moveNext(); 459 let done = !i.moveNext();
451 return { done: done, value: done ? void 0 : i.current }; 460 return { done: done, value: done ? void 0 : i.current };
452 } 461 }
453 } 462 }
454 exports.JsIterator = JsIterator; 463 exports.JsIterator = JsIterator;
455 464
456 465
457 }); 466 });
OLDNEW
« no previous file with comments | « no previous file | lib/runtime/dart/_interceptors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698