| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library elements.modelx; | 5 library elements.modelx; |
| 6 | 6 |
| 7 import 'elements.dart'; | 7 import 'elements.dart'; |
| 8 import '../../compiler.dart' as api; | 8 import '../../compiler.dart' as api; |
| 9 import '../tree/tree.dart'; | 9 import '../tree/tree.dart'; |
| 10 import '../util/util.dart'; | 10 import '../util/util.dart'; |
| (...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 } | 1511 } |
| 1512 assert(!isRedirectingFactory || internalRedirectionTarget != null); | 1512 assert(!isRedirectingFactory || internalRedirectionTarget != null); |
| 1513 return isRedirectingFactory ? internalRedirectionTarget : this; | 1513 return isRedirectingFactory ? internalRedirectionTarget : this; |
| 1514 } | 1514 } |
| 1515 | 1515 |
| 1516 InterfaceType computeTargetType(InterfaceType newType) { | 1516 InterfaceType computeTargetType(InterfaceType newType) { |
| 1517 if (!isRedirectingFactory) return newType; | 1517 if (!isRedirectingFactory) return newType; |
| 1518 assert(invariant(this, redirectionTargetType != null, | 1518 assert(invariant(this, redirectionTargetType != null, |
| 1519 message: 'Redirection target type has not yet been computed for ' | 1519 message: 'Redirection target type has not yet been computed for ' |
| 1520 '$this.')); | 1520 '$this.')); |
| 1521 return redirectionTargetType.subst(newType.typeArguments, | 1521 return redirectionTargetType.substByContext(newType); |
| 1522 newType.element.typeVariables); | |
| 1523 } | 1522 } |
| 1524 | 1523 |
| 1525 /** | 1524 /** |
| 1526 * Applies a patch function to this function. The patch function's body | 1525 * Applies a patch function to this function. The patch function's body |
| 1527 * is used as replacement when parsing this function's body. | 1526 * is used as replacement when parsing this function's body. |
| 1528 * This method must not be called after the function has been parsed, | 1527 * This method must not be called after the function has been parsed, |
| 1529 * and it must be called at most once. | 1528 * and it must be called at most once. |
| 1530 */ | 1529 */ |
| 1531 void setPatch(FunctionElement patchElement) { | 1530 void setPatch(FunctionElement patchElement) { |
| 1532 // Sanity checks. The caller must check these things before calling. | 1531 // Sanity checks. The caller must check these things before calling. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 if (functionSignature != null) return functionSignature; | 1663 if (functionSignature != null) return functionSignature; |
| 1665 if (isDefaultConstructor) { | 1664 if (isDefaultConstructor) { |
| 1666 return functionSignature = new FunctionSignatureX( | 1665 return functionSignature = new FunctionSignatureX( |
| 1667 const Link<Element>(), const Link<Element>(), 0, 0, false, | 1666 const Link<Element>(), const Link<Element>(), 0, 0, false, |
| 1668 getEnclosingClass().thisType); | 1667 getEnclosingClass().thisType); |
| 1669 } | 1668 } |
| 1670 if (superMember.isErroneous()) { | 1669 if (superMember.isErroneous()) { |
| 1671 return functionSignature = compiler.objectClass.localLookup('') | 1670 return functionSignature = compiler.objectClass.localLookup('') |
| 1672 .computeSignature(compiler); | 1671 .computeSignature(compiler); |
| 1673 } | 1672 } |
| 1673 // TODO(johnniwinther): Ensure that the function signature (and with it the |
| 1674 // function type) substitutes type variables correctly. |
| 1674 return functionSignature = superMember.computeSignature(compiler); | 1675 return functionSignature = superMember.computeSignature(compiler); |
| 1675 } | 1676 } |
| 1676 | 1677 |
| 1677 get declaration => this; | 1678 get declaration => this; |
| 1678 get implementation => this; | 1679 get implementation => this; |
| 1679 get defaultImplementation => this; | 1680 get defaultImplementation => this; |
| 1680 | 1681 |
| 1681 accept(ElementVisitor visitor) { | 1682 accept(ElementVisitor visitor) { |
| 1682 return visitor.visitFunctionElement(this); | 1683 return visitor.visitFunctionElement(this); |
| 1683 } | 1684 } |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2440 | 2441 |
| 2441 MetadataAnnotation ensureResolved(Compiler compiler) { | 2442 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 2442 if (resolutionState == STATE_NOT_STARTED) { | 2443 if (resolutionState == STATE_NOT_STARTED) { |
| 2443 compiler.resolver.resolveMetadataAnnotation(this); | 2444 compiler.resolver.resolveMetadataAnnotation(this); |
| 2444 } | 2445 } |
| 2445 return this; | 2446 return this; |
| 2446 } | 2447 } |
| 2447 | 2448 |
| 2448 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 2449 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 2449 } | 2450 } |
| OLD | NEW |