| 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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 } | 1143 } |
| 1144 | 1144 |
| 1145 static bool isInstanceMethod(Element element) { | 1145 static bool isInstanceMethod(Element element) { |
| 1146 return (element != null) | 1146 return (element != null) |
| 1147 && element.isInstanceMember() | 1147 && element.isInstanceMember() |
| 1148 && (element.kind === ElementKind.FUNCTION); | 1148 && (element.kind === ElementKind.FUNCTION); |
| 1149 } | 1149 } |
| 1150 | 1150 |
| 1151 static bool isInstanceSend(Send send, TreeElements elements) { | 1151 static bool isInstanceSend(Send send, TreeElements elements) { |
| 1152 Element element = elements[send]; | 1152 Element element = elements[send]; |
| 1153 if (element === null) return !isClosureSend(send, element); | 1153 if (element === null) return !isClosureSend(send, elements); |
| 1154 return isInstanceMethod(element) || isInstanceField(element); | 1154 return isInstanceMethod(element) || isInstanceField(element); |
| 1155 } | 1155 } |
| 1156 | 1156 |
| 1157 static bool isClosureSend(Send send, Element element) { | 1157 static bool isClosureSend(Send send, TreeElements elements) { |
| 1158 if (send.isPropertyAccess) return false; | 1158 if (send.isPropertyAccess) return false; |
| 1159 if (send.receiver !== null) return false; | 1159 if (send.receiver !== null) return false; |
| 1160 Element element = elements[send]; |
| 1160 // (o)() or foo()(). | 1161 // (o)() or foo()(). |
| 1161 if (element === null && send.selector.asIdentifier() === null) return true; | 1162 if (element === null && send.selector.asIdentifier() === null) return true; |
| 1162 if (element === null) return false; | 1163 if (element === null) return false; |
| 1163 // foo() with foo a local or a parameter. | 1164 // foo() with foo a local or a parameter. |
| 1164 return isLocal(element); | 1165 return isLocal(element); |
| 1165 } | 1166 } |
| 1166 | 1167 |
| 1167 static SourceString constructConstructorName(SourceString receiver, | 1168 static SourceString constructConstructorName(SourceString receiver, |
| 1168 SourceString selector) { | 1169 SourceString selector) { |
| 1169 String r = receiver.slowToString(); | 1170 String r = receiver.slowToString(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 TypeVariableElement(name, Element enclosing, this.cachedNode, | 1285 TypeVariableElement(name, Element enclosing, this.cachedNode, |
| 1285 [this.type, this.bound]) | 1286 [this.type, this.bound]) |
| 1286 : super(name, ElementKind.TYPE_VARIABLE, enclosing); | 1287 : super(name, ElementKind.TYPE_VARIABLE, enclosing); |
| 1287 | 1288 |
| 1288 TypeVariableType computeType(compiler) => type; | 1289 TypeVariableType computeType(compiler) => type; |
| 1289 | 1290 |
| 1290 Node parseNode(compiler) => cachedNode; | 1291 Node parseNode(compiler) => cachedNode; |
| 1291 | 1292 |
| 1292 String toString() => "${enclosingElement.toString()}.${name.slowToString()}"; | 1293 String toString() => "${enclosingElement.toString()}.${name.slowToString()}"; |
| 1293 } | 1294 } |
| OLD | NEW |