| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 $assert_(sig); | 176 $assert_(sig); |
| 177 $tag($f, sig); | 177 $tag($f, sig); |
| 178 return $f; | 178 return $f; |
| 179 })()'''); | 179 })()'''); |
| 180 | 180 |
| 181 /// Instantiate a generic method. | 181 /// Instantiate a generic method. |
| 182 /// | 182 /// |
| 183 /// We need to apply the type arguments both to the function, as well as its | 183 /// We need to apply the type arguments both to the function, as well as its |
| 184 /// associated function type. | 184 /// associated function type. |
| 185 gbind(f, @rest typeArgs) { | 185 gbind(f, @rest typeArgs) { |
| 186 var result = JS('', '#(...#)', f, typeArgs); | 186 var result = JS('', '#.apply(null, #)', f, typeArgs); |
| 187 var sig = JS('', '#(...#)', _getRuntimeType(f), typeArgs); | 187 var sig = JS('', '#.apply(null, #)', _getRuntimeType(f), typeArgs); |
| 188 tag(result, sig); | 188 tag(result, sig); |
| 189 return result; | 189 return result; |
| 190 } | 190 } |
| 191 | 191 |
| 192 // Set up the method signature field on the constructor | 192 // Set up the method signature field on the constructor |
| 193 _setMethodSignature(f, sigF) => JS('', '''(() => { | 193 _setMethodSignature(f, sigF) => JS('', '''(() => { |
| 194 $defineMemoizedGetter($f, $_methodSig, () => { | 194 $defineMemoizedGetter($f, $_methodSig, () => { |
| 195 let sigObj = $sigF(); | 195 let sigObj = $sigF(); |
| 196 sigObj.__proto__ = $f.__proto__[$_methodSig]; | 196 sigObj.__proto__ = $f.__proto__[$_methodSig]; |
| 197 return sigObj; | 197 return sigObj; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 })()'''); | 386 })()'''); |
| 387 | 387 |
| 388 /// Sets the element type of a list literal. | 388 /// Sets the element type of a list literal. |
| 389 list(obj, elementType) => | 389 list(obj, elementType) => |
| 390 JS('', '$setType($obj, ${getGenericClass(JSArray)}($elementType))'); | 390 JS('', '$setType($obj, ${getGenericClass(JSArray)}($elementType))'); |
| 391 | 391 |
| 392 setBaseClass(derived, base) => JS('', '''(() => { | 392 setBaseClass(derived, base) => JS('', '''(() => { |
| 393 // Link the extension to the type it's extending as a base class. | 393 // Link the extension to the type it's extending as a base class. |
| 394 $derived.prototype.__proto__ = $base.prototype; | 394 $derived.prototype.__proto__ = $base.prototype; |
| 395 })()'''); | 395 })()'''); |
| OLD | NEW |