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