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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 }); | 57 }); |
58 | 58 |
59 // Save mixins for reflection | 59 // Save mixins for reflection |
60 Mixin[$_mixins] = $mixins; | 60 Mixin[$_mixins] = $mixins; |
61 return Mixin; | 61 return Mixin; |
62 })()'''); | 62 })()'''); |
63 | 63 |
64 /// The Symbol for storing type arguments on a specialized generic type. | 64 /// The Symbol for storing type arguments on a specialized generic type. |
65 final _mixins = JS('', 'Symbol("mixins")'); | 65 final _mixins = JS('', 'Symbol("mixins")'); |
66 | 66 |
67 getMixins(clazz) => JS('', '$clazz[$_mixins]'); | 67 getMixins(clazz) => JS('', 'Object.hasOwnProperty.call(#, #) ? #[#] : null', cla
zz, _mixins, clazz, _mixins); |
68 | 68 |
69 @JSExportName('implements') | 69 @JSExportName('implements') |
70 final _implements = JS('', 'Symbol("implements")'); | 70 final _implements = JS('', 'Symbol("implements")'); |
71 | 71 |
72 getImplements(clazz) => JS('', '#[#]', clazz, _implements); | 72 getImplements(clazz) => JS('', 'Object.hasOwnProperty.call(#, #) ? #[#] : null',
clazz, _implements, clazz, _implements); |
73 | 73 |
74 /// The Symbol for storing type arguments on a specialized generic type. | 74 /// The Symbol for storing type arguments on a specialized generic type. |
75 final _typeArguments = JS('', 'Symbol("typeArguments")'); | 75 final _typeArguments = JS('', 'Symbol("typeArguments")'); |
76 | 76 |
77 final _originalDeclaration = JS('', 'Symbol("originalDeclaration")'); | 77 final _originalDeclaration = JS('', 'Symbol("originalDeclaration")'); |
78 | 78 |
79 /// Wrap a generic class builder function with future flattening. | 79 /// Wrap a generic class builder function with future flattening. |
80 flattenFutures(builder) => JS( | 80 flattenFutures(builder) => JS( |
81 '', | 81 '', |
82 '''(() => { | 82 '''(() => { |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 '''(() => { | 548 '''(() => { |
549 let values = []; | 549 let values = []; |
550 for (var i = 0; i < $names.length; i++) { | 550 for (var i = 0; i < $names.length; i++) { |
551 let value = $const_(new $enumClass(i)); | 551 let value = $const_(new $enumClass(i)); |
552 values.push(value); | 552 values.push(value); |
553 Object.defineProperty($enumClass, $names[i], | 553 Object.defineProperty($enumClass, $names[i], |
554 { value: value, configurable: true }); | 554 { value: value, configurable: true }); |
555 } | 555 } |
556 $enumClass.values = $constList(values, $enumClass); | 556 $enumClass.values = $constList(values, $enumClass); |
557 })()'''); | 557 })()'''); |
OLD | NEW |