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

Side by Side Diff: lib/runtime/_operations.js

Issue 1233553005: Fixes #254 - Better stacktrace support (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 5 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') | lib/src/codegen/js_codegen.dart » ('J')
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 262 }
263 return map; 263 return map;
264 } 264 }
265 exports.map = map; 265 exports.map = map;
266 266
267 function assert(condition) { 267 function assert(condition) {
268 if (!condition) errors.throwAssertionError(); 268 if (!condition) errors.throwAssertionError();
269 } 269 }
270 exports.assert = assert; 270 exports.assert = assert;
271 271
272 function throw_(obj) { throw obj; } 272 let _stack = Symbol('_stack');
273
274 function throw_(obj) {
275 obj[_stack] = new Error();
276 throw obj;
277 }
273 exports.throw_ = throw_; 278 exports.throw_ = throw_;
Jennifer Messerly 2015/07/13 16:39:17 btw, this should be `throw` ... all names work for
vsm 2015/07/14 13:54:48 Done.
274 279
280 function rethrow(obj) {
Jennifer Messerly 2015/07/13 16:39:17 if this doesn't do anything, why have the helper?
vsm 2015/07/14 13:54:48 Removed
281 throw obj;
282 }
283 exports.rethrow = rethrow;
275 284
276 function stackTrace(exception) { 285 function stackTrace(exception) {
277 return _js_helper.getTraceFromException(exception); 286 var error = _stack in exception ? exception[_stack] : exception;
287 return _js_helper.getTraceFromException(error);
278 } 288 }
279 exports.stackTrace = stackTrace; 289 exports.stackTrace = stackTrace;
280 290
281 let _value = Symbol('_value'); 291 let _value = Symbol('_value');
282 /** 292 /**
283 * Looks up a sequence of [keys] in [map], recursively, and 293 * Looks up a sequence of [keys] in [map], recursively, and
284 * returns the result. If the value is not found, [valueFn] will be called to 294 * returns the result. If the value is not found, [valueFn] will be called to
285 * add it. For example: 295 * add it. For example:
286 * 296 *
287 * let map = new Map(); 297 * let map = new Map();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 next() { 399 next() {
390 let i = this.dartIterator; 400 let i = this.dartIterator;
391 let done = !i.moveNext(); 401 let done = !i.moveNext();
392 return { done: done, value: done ? void 0 : i.current }; 402 return { done: done, value: done ? void 0 : i.current };
393 } 403 }
394 } 404 }
395 exports.JsIterator = JsIterator; 405 exports.JsIterator = JsIterator;
396 406
397 407
398 }); 408 });
OLDNEW
« no previous file with comments | « no previous file | lib/runtime/dart/_interceptors.js » ('j') | lib/src/codegen/js_codegen.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698