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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 861093002: Support intercepted getters, setters and index operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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) 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 // IrNodes are kept in a separate library to have precise control over their 5 // IrNodes are kept in a separate library to have precise control over their
6 // dependencies on other parts of the system. 6 // dependencies on other parts of the system.
7 library dart2js.ir_nodes; 7 library dart2js.ir_nodes;
8 8
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../constants/values.dart' as values show ConstantValue; 10 import '../constants/values.dart' as values show ConstantValue;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 assert(target is ErroneousElement || selector.name == target.name); 191 assert(target is ErroneousElement || selector.name == target.name);
192 } 192 }
193 193
194 accept(Visitor visitor) => visitor.visitInvokeStatic(this); 194 accept(Visitor visitor) => visitor.visitInvokeStatic(this);
195 } 195 }
196 196
197 /// Invoke a method, operator, getter, setter, or index getter/setter. 197 /// Invoke a method, operator, getter, setter, or index getter/setter.
198 /// Converting a method to a function object is treated as a getter invocation. 198 /// Converting a method to a function object is treated as a getter invocation.
199 class InvokeMethod extends Expression implements Invoke { 199 class InvokeMethod extends Expression implements Invoke {
200 Reference<Primitive> receiver; 200 Reference<Primitive> receiver;
201 final Selector selector; 201 Selector selector;
202 final Reference<Continuation> continuation; 202 final Reference<Continuation> continuation;
203 final List<Reference<Primitive>> arguments; 203 final List<Reference<Primitive>> arguments;
204 204
205 InvokeMethod(Primitive receiver, 205 InvokeMethod(Primitive receiver,
206 Selector selector, 206 Selector selector,
207 Continuation cont, 207 Continuation continuation,
208 List<Primitive> args) 208 List<Primitive> arguments)
209 : this.internal(new Reference<Primitive>(receiver), 209 : this.internal(new Reference<Primitive>(receiver),
210 selector, 210 selector,
211 new Reference<Continuation>(cont), 211 new Reference<Continuation>(continuation),
212 _referenceList(args)); 212 _referenceList(arguments));
213 213
214 InvokeMethod.internal(this.receiver, 214 InvokeMethod.internal(this.receiver,
215 this.selector, 215 this.selector,
216 this.continuation, 216 this.continuation,
217 this.arguments) { 217 this.arguments) {
218 assert(selector != null); 218 assert(selector != null);
219 assert(selector.kind == SelectorKind.CALL || 219 assert(selector.kind == SelectorKind.CALL ||
220 selector.kind == SelectorKind.OPERATOR || 220 selector.kind == SelectorKind.OPERATOR ||
221 (selector.kind == SelectorKind.GETTER && arguments.isEmpty) || 221 (selector.kind == SelectorKind.GETTER && arguments.isEmpty) ||
222 (selector.kind == SelectorKind.SETTER && arguments.length == 1) || 222 (selector.kind == SelectorKind.SETTER && arguments.length == 1) ||
223 (selector.kind == SelectorKind.INDEX && arguments.length == 1) || 223 (selector.kind == SelectorKind.INDEX && arguments.length == 1) ||
224 (selector.kind == SelectorKind.INDEX && arguments.length == 2)); 224 (selector.kind == SelectorKind.INDEX && arguments.length == 2));
225 } 225 }
226 226
227 bool get isIntercepted => receiver.definition is Interceptor;
228
229 accept(Visitor visitor) => visitor.visitInvokeMethod(this); 227 accept(Visitor visitor) => visitor.visitInvokeMethod(this);
230 } 228 }
231 229
232 /// Invoke [target] on [receiver], bypassing dispatch and override semantics. 230 /// Invoke [target] on [receiver], bypassing dispatch and override semantics.
233 /// 231 ///
234 /// That is, if [receiver] is an instance of a class that overrides [target] 232 /// That is, if [receiver] is an instance of a class that overrides [target]
235 /// with a different implementation, the overriding implementation is bypassed 233 /// with a different implementation, the overriding implementation is bypassed
236 /// and [target]'s implementation is invoked. 234 /// and [target]'s implementation is invoked.
237 /// 235 ///
238 /// As with [InvokeMethod], this can be used to invoke a method, operator, 236 /// As with [InvokeMethod], this can be used to invoke a method, operator,
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 1331
1334 void visitIdentical(Identical node) { 1332 void visitIdentical(Identical node) {
1335 visitReference(node.left); 1333 visitReference(node.left);
1336 visitReference(node.right); 1334 visitReference(node.right);
1337 } 1335 }
1338 1336
1339 void visitInterceptor(Interceptor node) { 1337 void visitInterceptor(Interceptor node) {
1340 visitReference(node.input); 1338 visitReference(node.input);
1341 } 1339 }
1342 } 1340 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698