| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 $tag($f, sig); | 279 $tag($f, sig); |
| 280 return $f; | 280 return $f; |
| 281 })()'''); | 281 })()'''); |
| 282 | 282 |
| 283 /// Instantiate a generic method. | 283 /// Instantiate a generic method. |
| 284 /// | 284 /// |
| 285 /// We need to apply the type arguments both to the function, as well as its | 285 /// We need to apply the type arguments both to the function, as well as its |
| 286 /// associated function type. | 286 /// associated function type. |
| 287 gbind(f, @rest typeArgs) { | 287 gbind(f, @rest typeArgs) { |
| 288 var result = JS('', '#.apply(null, #)', f, typeArgs); | 288 var result = JS('', '#.apply(null, #)', f, typeArgs); |
| 289 var sig = JS('', '#.apply(null, #)', _getRuntimeType(f), typeArgs); | 289 var sig = JS('', '#.instantiate(#)', _getRuntimeType(f), typeArgs); |
| 290 tag(result, sig); | 290 tag(result, sig); |
| 291 return result; | 291 return result; |
| 292 } | 292 } |
| 293 | 293 |
| 294 // Set up the method signature field on the constructor | 294 // Set up the method signature field on the constructor |
| 295 _setInstanceSignature(f, sigF, kind) => JS( | 295 _setInstanceSignature(f, sigF, kind) => JS( |
| 296 '', | 296 '', |
| 297 '''(() => { | 297 '''(() => { |
| 298 $defineMemoizedGetter($f, $kind, () => { | 298 $defineMemoizedGetter($f, $kind, () => { |
| 299 let sigObj = $sigF(); | 299 let sigObj = $sigF(); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 '''(() => { | 638 '''(() => { |
| 639 let values = []; | 639 let values = []; |
| 640 for (var i = 0; i < $names.length; i++) { | 640 for (var i = 0; i < $names.length; i++) { |
| 641 let value = $const_(new $enumClass(i)); | 641 let value = $const_(new $enumClass(i)); |
| 642 values.push(value); | 642 values.push(value); |
| 643 Object.defineProperty($enumClass, $names[i], | 643 Object.defineProperty($enumClass, $names[i], |
| 644 { value: value, configurable: true }); | 644 { value: value, configurable: true }); |
| 645 } | 645 } |
| 646 $enumClass.values = $constList(values, $enumClass); | 646 $enumClass.values = $constList(values, $enumClass); |
| 647 })()'''); | 647 })()'''); |
| OLD | NEW |