| 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 | 4 |
| 5 /// This library defines the operations that define and manipulate Dart | 5 /// This library defines the operations that define and manipulate Dart |
| 6 /// classes. Included in this are: | 6 /// classes. Included in this are: |
| 7 /// - Generics | 7 /// - Generics |
| 8 /// - Class metadata | 8 /// - Class metadata |
| 9 /// - Extension methods | 9 /// - Extension methods |
| 10 /// | 10 /// |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 /// | 533 /// |
| 534 /// The constructor | 534 /// The constructor |
| 535 defineNamedConstructorCallable(clazz, name, ctor) => JS( | 535 defineNamedConstructorCallable(clazz, name, ctor) => JS( |
| 536 '', | 536 '', |
| 537 '''(() => { | 537 '''(() => { |
| 538 ctor.prototype = $clazz.prototype; | 538 ctor.prototype = $clazz.prototype; |
| 539 // Use defineProperty so we don't hit a property defined on Function, | 539 // Use defineProperty so we don't hit a property defined on Function, |
| 540 // like `caller` and `arguments`. | 540 // like `caller` and `arguments`. |
| 541 $defineProperty($clazz, $name, { value: ctor, configurable: true }); | 541 $defineProperty($clazz, $name, { value: ctor, configurable: true }); |
| 542 })()'''); | 542 })()'''); |
| 543 |
| 544 defineEnumValues(enumClass, names) => JS( |
| 545 '', |
| 546 '''(() => { |
| 547 let values = []; |
| 548 for (var i = 0; i < $names.length; i++) { |
| 549 let value = $const_(new $enumClass(i)); |
| 550 values.push(value); |
| 551 Object.defineProperty($enumClass, $names[i], |
| 552 { value: value, configurable: true }); |
| 553 } |
| 554 $enumClass.values = $constList(values, $enumClass); |
| 555 })()'''); |
| OLD | NEW |