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

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

Issue 10441044: Refactor common logic of SsaBuilder.visitSend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor typo Created 8 years, 6 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
« no previous file with comments | « lib/compiler/implementation/leg.dart ('k') | lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 class ResolvedVisitor<R> implements Visitor<R> {
6 TreeElements elements;
7
8 ResolvedVisitor(this.elements);
9
10 R visitSend(Send node) {
11 if (node.isSuperCall) {
12 return visitSuperSend(node);
13 } else if (node.isOperator) {
14 return visitOperatorSend(node);
15 } else if (node.isPropertyAccess) {
16 return visitGetterSend(node);
17 } else if (Elements.isClosureSend(node, elements)) {
18 return visitClosureSend(node);
19 } else {
20 Element element = elements[node];
21 if (element === null) {
22 // Example: f() with 'f' unbound.
23 // This can only happen inside an instance method.
24 return visitDynamicSend(node);
25 } else if (element.kind == ElementKind.CLASS) {
26 internalError("Cannot generate code for send", node: node);
27 } else if (element.isInstanceMember()) {
28 // Example: f() with 'f' bound to instance method.
29 return visitDynamicSend(node);
30 } else if (element.kind === ElementKind.FOREIGN) {
31 return visitForeignSend(node);
32 } else if (!element.isInstanceMember()) {
33 // Example: A.f() or f() with 'f' bound to a static function.
34 // Also includes new A() or new A.named() which is treated like a
35 // static call to a factory.
36 return visitStaticSend(node);
37 } else {
38 internalError("Cannot generate code for send", node: node);
39 }
40 }
41 }
42
43 abstract R visitSuperSend(Send node);
44 abstract R visitOperatorSend(Send node);
45 abstract R visitGetterSend(Send node);
46 abstract R visitClosureSend(Send node);
47 abstract R visitDynamicSend(Send node);
48 abstract R visitForeignSend(Send node);
49 abstract R visitStaticSend(Send node);
50
51 abstract void internalError(String reason, [Node node]);
52 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/leg.dart ('k') | lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698