Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: lib/compiler/implementation/elements/elements.dart

Issue 10834270: Implement call operator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 } 1135 }
1136 1136
1137 static bool isInstanceMethod(Element element) { 1137 static bool isInstanceMethod(Element element) {
1138 return (element != null) 1138 return (element != null)
1139 && element.isInstanceMember() 1139 && element.isInstanceMember()
1140 && (element.kind === ElementKind.FUNCTION); 1140 && (element.kind === ElementKind.FUNCTION);
1141 } 1141 }
1142 1142
1143 static bool isInstanceSend(Send send, TreeElements elements) { 1143 static bool isInstanceSend(Send send, TreeElements elements) {
1144 Element element = elements[send]; 1144 Element element = elements[send];
1145 if (element === null) return !isClosureSend(send, elements); 1145 if (element === null) return !isClosureSend(send, element);
1146 return isInstanceMethod(element) || isInstanceField(element); 1146 return isInstanceMethod(element) || isInstanceField(element);
1147 } 1147 }
1148 1148
1149 static bool isClosureSend(Send send, TreeElements elements) { 1149 static bool isClosureSend(Send send, Element element) {
1150 if (send.isPropertyAccess) return false; 1150 if (send.isPropertyAccess) return false;
1151 if (send.receiver !== null) return false; 1151 if (send.receiver !== null) return false;
1152 Element element = elements[send];
1153 // (o)() or foo()(). 1152 // (o)() or foo()().
1154 if (element === null && send.selector.asIdentifier() === null) return true; 1153 if (element === null && send.selector.asIdentifier() === null) return true;
1155 if (element === null) return false; 1154 if (element === null) return false;
1156 // foo() with foo a local or a parameter. 1155 // foo() with foo a local or a parameter.
1157 return isLocal(element); 1156 return isLocal(element);
1158 } 1157 }
1159 1158
1160 static SourceString constructConstructorName(SourceString receiver, 1159 static SourceString constructConstructorName(SourceString receiver,
1161 SourceString selector) { 1160 SourceString selector) {
1162 String r = receiver.slowToString(); 1161 String r = receiver.slowToString();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 TypeVariableElement(name, Element enclosing, this.cachedNode, 1276 TypeVariableElement(name, Element enclosing, this.cachedNode,
1278 [this.type, this.bound]) 1277 [this.type, this.bound])
1279 : super(name, ElementKind.TYPE_VARIABLE, enclosing); 1278 : super(name, ElementKind.TYPE_VARIABLE, enclosing);
1280 1279
1281 TypeVariableType computeType(compiler) => type; 1280 TypeVariableType computeType(compiler) => type;
1282 1281
1283 Node parseNode(compiler) => cachedNode; 1282 Node parseNode(compiler) => cachedNode;
1284 1283
1285 String toString() => "${enclosingElement.toString()}.${name.slowToString()}"; 1284 String toString() => "${enclosingElement.toString()}.${name.slowToString()}";
1286 } 1285 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/lib/js_helper.dart » ('j') | lib/compiler/implementation/namer.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698