| OLD | NEW |
| 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 /// The JavaScript undefined constant. |
| 11 /// |
| 12 /// This is initialized by DDC to JS void 0. |
| 13 const undefined = null; |
| 14 |
| 10 defineProperty(obj, name, desc) => | 15 defineProperty(obj, name, desc) => |
| 11 JS('', 'Object.defineProperty(#, #, #)', obj, name, desc); | 16 JS('', 'Object.defineProperty(#, #, #)', obj, name, desc); |
| 12 | 17 |
| 13 defineValue(obj, name, value) { | 18 defineValue(obj, name, value) { |
| 14 defineProperty(obj, name, | 19 defineProperty(obj, name, |
| 15 JS('', '{ value: #, configurable: true, writable: true }', value)); | 20 JS('', '{ value: #, configurable: true, writable: true }', value)); |
| 16 return value; | 21 return value; |
| 17 } | 22 } |
| 18 | 23 |
| 19 void defineGetter(obj, name, getter) { | 24 void defineGetter(obj, name, getter) { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 126 } |
| 122 | 127 |
| 123 @JSExportName('export') | 128 @JSExportName('export') |
| 124 exportProperty(to, from, name) => copyProperty(to, from, name); | 129 exportProperty(to, from, name) => copyProperty(to, from, name); |
| 125 | 130 |
| 126 /// Copy properties from source to destination object. | 131 /// Copy properties from source to destination object. |
| 127 /// This operation is commonly called `mixin` in JS. | 132 /// This operation is commonly called `mixin` in JS. |
| 128 copyProperties(to, from) { | 133 copyProperties(to, from) { |
| 129 return copyTheseProperties(to, from, getOwnNamesAndSymbols(from)); | 134 return copyTheseProperties(to, from, getOwnNamesAndSymbols(from)); |
| 130 } | 135 } |
| OLD | NEW |