| 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('../tree/tree.dart'); | 7 #import('../tree/tree.dart'); |
| 8 #import('../scanner/scannerlib.dart'); | 8 #import('../scanner/scannerlib.dart'); |
| 9 #import('../leg.dart'); // TODO(karlklose): we only need type. | 9 #import('../leg.dart'); // TODO(karlklose): we only need type. |
| 10 #import('../util/util.dart'); | 10 #import('../util/util.dart'); |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 } | 701 } |
| 702 | 702 |
| 703 FunctionType computeType(Compiler compiler) { | 703 FunctionType computeType(Compiler compiler) { |
| 704 if (type != null) return type; | 704 if (type != null) return type; |
| 705 type = compiler.computeFunctionType(this, computeSignature(compiler)); | 705 type = compiler.computeFunctionType(this, computeSignature(compiler)); |
| 706 return type; | 706 return type; |
| 707 } | 707 } |
| 708 | 708 |
| 709 Node parseNode(DiagnosticListener listener) { | 709 Node parseNode(DiagnosticListener listener) { |
| 710 if (cachedNode !== null) return cachedNode; | 710 if (cachedNode !== null) return cachedNode; |
| 711 if (patch !== null) { | 711 if (patch === null) { |
| 712 cachedNode = patch.parseNode(listener); | 712 if (modifiers.isExternal()) { |
| 713 // An external function that isn't patched has no body. |
| 714 return null; |
| 715 } |
| 716 return cachedNode; |
| 713 } | 717 } |
| 718 cachedNode = patch.parseNode(listener); |
| 714 return cachedNode; | 719 return cachedNode; |
| 715 } | 720 } |
| 716 | 721 |
| 717 Token position() => cachedNode.getBeginToken(); | 722 Token position() => cachedNode.getBeginToken(); |
| 718 | 723 |
| 719 FunctionElement asFunctionElement() => this; | 724 FunctionElement asFunctionElement() => this; |
| 720 } | 725 } |
| 721 | 726 |
| 722 class ConstructorBodyElement extends FunctionElement { | 727 class ConstructorBodyElement extends FunctionElement { |
| 723 FunctionElement constructor; | 728 FunctionElement constructor; |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 final Node node; | 1141 final Node node; |
| 1137 Type bound; | 1142 Type bound; |
| 1138 Type type; | 1143 Type type; |
| 1139 TypeVariableElement(name, Element enclosing, this.node, this.type, | 1144 TypeVariableElement(name, Element enclosing, this.node, this.type, |
| 1140 [this.bound]) | 1145 [this.bound]) |
| 1141 : super(name, ElementKind.TYPE_VARIABLE, enclosing); | 1146 : super(name, ElementKind.TYPE_VARIABLE, enclosing); |
| 1142 Type computeType(compiler) => type; | 1147 Type computeType(compiler) => type; |
| 1143 Node parseNode(compiler) => node; | 1148 Node parseNode(compiler) => node; |
| 1144 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; | 1149 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; |
| 1145 } | 1150 } |
| OLD | NEW |