| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 let sig = originalSigFn(); | 375 let sig = originalSigFn(); |
| 376 for (let name of methodNames) { | 376 for (let name of methodNames) { |
| 377 sig[getExtensionSymbol(name)] = sig[name]; | 377 sig[getExtensionSymbol(name)] = sig[name]; |
| 378 } | 378 } |
| 379 return sig; | 379 return sig; |
| 380 }); | 380 }); |
| 381 } | 381 } |
| 382 exports.defineExtensionMembers = defineExtensionMembers; | 382 exports.defineExtensionMembers = defineExtensionMembers; |
| 383 | 383 |
| 384 function canonicalMember(obj, name) { | 384 function canonicalMember(obj, name) { |
| 385 if (obj[_extensionType]) return dartx[name]; | 385 if (obj != null && obj[_extensionType]) return dartx[name]; |
| 386 return name; | 386 return name; |
| 387 } | 387 } |
| 388 exports.canonicalMember = canonicalMember; | 388 exports.canonicalMember = canonicalMember; |
| 389 | 389 |
| 390 /** Sets the type of `obj` to be `type` */ | 390 /** Sets the type of `obj` to be `type` */ |
| 391 function setType(obj, type) { | 391 function setType(obj, type) { |
| 392 obj.__proto__ = type.prototype; | 392 obj.__proto__ = type.prototype; |
| 393 return obj; | 393 return obj; |
| 394 } | 394 } |
| 395 | 395 |
| 396 /** Sets the element type of a list literal. */ | 396 /** Sets the element type of a list literal. */ |
| 397 function list(obj, elementType) { | 397 function list(obj, elementType) { |
| 398 return setType(obj, _interceptors.JSArray$(elementType)); | 398 return setType(obj, _interceptors.JSArray$(elementType)); |
| 399 } | 399 } |
| 400 exports.list = list; | 400 exports.list = list; |
| 401 | 401 |
| 402 function setBaseClass(derived, base) { | 402 function setBaseClass(derived, base) { |
| 403 // Link the extension to the type it's extending as a base class. | 403 // Link the extension to the type it's extending as a base class. |
| 404 derived.prototype.__proto__ = base.prototype; | 404 derived.prototype.__proto__ = base.prototype; |
| 405 } | 405 } |
| 406 exports.setBaseClass = setBaseClass; | 406 exports.setBaseClass = setBaseClass; |
| 407 | 407 |
| 408 }); | 408 }); |
| OLD | NEW |