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

Side by Side Diff: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/utils.dart

Issue 2519873004: Set auto breakpoint at various errors (Closed)
Patch Set: Reland Created 4 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
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 part of dart._runtime; 4 part of dart._runtime;
5 5
6 /// This library defines a set of general javascript utilities for us 6 /// This library defines a set of general javascript utilities for us
7 /// by the Dart runtime. 7 /// by the Dart runtime.
8 // TODO(ochafik): Rewrite some of these in Dart when possible. 8 // TODO(ochafik): Rewrite some of these in Dart when possible.
9 9
10 defineProperty(obj, name, desc) => 10 defineProperty(obj, name, desc) =>
11 JS('', 'Object.defineProperty(#, #, #)', obj, name, desc); 11 JS('', 'Object.defineProperty(#, #, #)', obj, name, desc);
12 12
13 getOwnPropertyDescriptor(obj, name) => 13 getOwnPropertyDescriptor(obj, name) =>
14 JS('', 'Object.getOwnPropertyDescriptor(#, #)', obj, name); 14 JS('', 'Object.getOwnPropertyDescriptor(#, #)', obj, name);
15 15
16 Iterable getOwnPropertyNames(obj) => 16 Iterable getOwnPropertyNames(obj) =>
17 JS('', 'Object.getOwnPropertyNames(#)', obj); 17 JS('', 'Object.getOwnPropertyNames(#)', obj);
18 18
19 Iterable getOwnPropertySymbols(obj) => 19 Iterable getOwnPropertySymbols(obj) =>
20 JS('', 'Object.getOwnPropertySymbols(#)', obj); 20 JS('', 'Object.getOwnPropertySymbols(#)', obj);
21 21
22 final hasOwnProperty = JS('', 'Object.prototype.hasOwnProperty'); 22 final hasOwnProperty = JS('', 'Object.prototype.hasOwnProperty');
23 23
24 void debugger() {
25 JS('', 'debugger');
26 }
27
24 /// This error indicates a strong mode specific failure, other than a type 28 /// This error indicates a strong mode specific failure, other than a type
25 /// assertion failure (TypeError) or CastError. 29 /// assertion failure (TypeError) or CastError.
26 void throwStrongModeError(String message) { 30 void throwStrongModeError(String message) {
31 debugger();
Jennifer Messerly 2016/11/21 22:16:05 same here, maybe just inline this:" JS('', 'd
vsm 2016/11/21 22:39:25 Done.
27 JS('', 'throw new #(#);', StrongModeErrorImplementation, message); 32 JS('', 'throw new #(#);', StrongModeErrorImplementation, message);
28 } 33 }
29 34
30 /// This error indicates a bug in the runtime or the compiler. 35 /// This error indicates a bug in the runtime or the compiler.
31 void throwInternalError(String message) { 36 void throwInternalError(String message) {
37 debugger();
32 JS('', 'throw Error(#)', message); 38 JS('', 'throw Error(#)', message);
33 } 39 }
34 40
35 getOwnNamesAndSymbols(obj) { 41 getOwnNamesAndSymbols(obj) {
36 var names = getOwnPropertyNames(obj); 42 var names = getOwnPropertyNames(obj);
37 var symbols = getOwnPropertySymbols(obj); 43 var symbols = getOwnPropertySymbols(obj);
38 return JS('', '#.concat(#)', names, symbols); 44 return JS('', '#.concat(#)', names, symbols);
39 } 45 }
40 46
41 safeGetOwnProperty(obj, String name) { 47 safeGetOwnProperty(obj, String name) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 115 }
110 116
111 @JSExportName('export') 117 @JSExportName('export')
112 exportProperty(to, from, name) => copyProperty(to, from, name); 118 exportProperty(to, from, name) => copyProperty(to, from, name);
113 119
114 /// Copy properties from source to destination object. 120 /// Copy properties from source to destination object.
115 /// This operation is commonly called `mixin` in JS. 121 /// This operation is commonly called `mixin` in JS.
116 copyProperties(to, from) { 122 copyProperties(to, from) {
117 return copyTheseProperties(to, from, getOwnNamesAndSymbols(from)); 123 return copyTheseProperties(to, from, getOwnNamesAndSymbols(from));
118 } 124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698