| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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'); | 5 #library('elements'); |
| 6 | 6 |
| 7 #import('dart:uri'); | 7 #import('dart:uri'); |
| 8 | 8 |
| 9 #import('../tree/tree.dart'); | 9 #import('../tree/tree.dart'); |
| 10 #import('../scanner/scannerlib.dart'); | 10 #import('../scanner/scannerlib.dart'); |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 : super(null, kind, enclosing), | 715 : super(null, kind, enclosing), |
| 716 this.cachedNode = node, | 716 this.cachedNode = node, |
| 717 this.modifiers = node.modifiers; | 717 this.modifiers = node.modifiers; |
| 718 | 718 |
| 719 VariableDefinitions parseNode(DiagnosticListener listener) { | 719 VariableDefinitions parseNode(DiagnosticListener listener) { |
| 720 return cachedNode; | 720 return cachedNode; |
| 721 } | 721 } |
| 722 | 722 |
| 723 DartType computeType(Compiler compiler) { | 723 DartType computeType(Compiler compiler) { |
| 724 if (type != null) return type; | 724 if (type != null) return type; |
| 725 VariableDefinitions node = parseNode(compiler); | 725 compiler.withCurrentElement(this, () { |
| 726 if (node.type !== null) { | 726 VariableDefinitions node = parseNode(compiler); |
| 727 type = compiler.resolveTypeAnnotation(this, node.type); | 727 if (node.type !== null) { |
| 728 } else { | 728 type = compiler.resolveTypeAnnotation(this, node.type); |
| 729 // Is node.definitions exactly one FunctionExpression? | 729 } else { |
| 730 Link<Node> link = node.definitions.nodes; | 730 // Is node.definitions exactly one FunctionExpression? |
| 731 if (!link.isEmpty() && | 731 Link<Node> link = node.definitions.nodes; |
| 732 link.head.asFunctionExpression() !== null && | 732 if (!link.isEmpty() && |
| 733 link.tail.isEmpty()) { | 733 link.head.asFunctionExpression() !== null && |
| 734 FunctionExpression functionExpression = link.head; | 734 link.tail.isEmpty()) { |
| 735 // We found exactly one FunctionExpression | 735 FunctionExpression functionExpression = link.head; |
| 736 compiler.withCurrentElement(this, () { | 736 // We found exactly one FunctionExpression |
| 737 functionSignature = | 737 functionSignature = |
| 738 compiler.resolveFunctionExpression(this, functionExpression); | 738 compiler.resolveFunctionExpression(this, functionExpression); |
| 739 }); | 739 type = compiler.computeFunctionType(compiler.functionClass, |
| 740 type = compiler.computeFunctionType(compiler.functionClass, | 740 functionSignature); |
| 741 functionSignature); | 741 } else { |
| 742 } else { | 742 type = compiler.types.dynamicType; |
| 743 type = compiler.types.dynamicType; | 743 } |
| 744 } | 744 } |
| 745 } | 745 }); |
| 746 assert(type != null); | 746 assert(type != null); |
| 747 return type; | 747 return type; |
| 748 } | 748 } |
| 749 | 749 |
| 750 Token position() => cachedNode.getBeginToken(); | 750 Token position() => cachedNode.getBeginToken(); |
| 751 | 751 |
| 752 VariableListElement cloneTo(Element enclosing, DiagnosticListener listener) { | 752 VariableListElement cloneTo(Element enclosing, DiagnosticListener listener) { |
| 753 VariableListElement result; | 753 VariableListElement result; |
| 754 if (cachedNode !== null) { | 754 if (cachedNode !== null) { |
| 755 result = new VariableListElement.node(cachedNode, kind, enclosing); | 755 result = new VariableListElement.node(cachedNode, kind, enclosing); |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 | 1649 |
| 1650 MetadataAnnotation ensureResolved(Compiler compiler) { | 1650 MetadataAnnotation ensureResolved(Compiler compiler) { |
| 1651 if (resolutionState == STATE_NOT_STARTED) { | 1651 if (resolutionState == STATE_NOT_STARTED) { |
| 1652 compiler.resolver.resolveMetadataAnnotation(this); | 1652 compiler.resolver.resolveMetadataAnnotation(this); |
| 1653 } | 1653 } |
| 1654 return this; | 1654 return this; |
| 1655 } | 1655 } |
| 1656 | 1656 |
| 1657 String toString() => 'MetadataAnnotation($value, $resolutionState)'; | 1657 String toString() => 'MetadataAnnotation($value, $resolutionState)'; |
| 1658 } | 1658 } |
| OLD | NEW |