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

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

Issue 694353007: Move dart2js from sdk/lib/_internal/compiler to pkg/compiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
(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 part of dart2js;
6
7 abstract class ResolvedVisitor<R> extends Visitor<R> {
8 TreeElements elements;
9
10 ResolvedVisitor(this.elements);
11
12 R visitSend(Send node) {
13 Element element = elements[node];
14 if (elements.isAssert(node)) {
15 return visitAssert(node);
16 } else if (elements.isTypeLiteral(node)) {
17 return visitTypeLiteralSend(node);
18 } else if (node.isSuperCall) {
19 return visitSuperSend(node);
20 } else if (node.isOperator) {
21 return visitOperatorSend(node);
22 } else if (node.isPropertyAccess) {
23 if (!Elements.isUnresolved(element) && element.impliesType) {
24 return visitTypePrefixSend(node);
25 } else {
26 return visitGetterSend(node);
27 }
28 } else if (element != null && Initializers.isConstructorRedirect(node)) {
29 return visitStaticSend(node);
30 } else if (Elements.isClosureSend(node, element)) {
31 return visitClosureSend(node);
32 } else {
33 if (Elements.isUnresolved(element)) {
34 if (element == null) {
35 // Example: f() with 'f' unbound.
36 // This can only happen inside an instance method.
37 return visitDynamicSend(node);
38 } else {
39 return visitStaticSend(node);
40 }
41 } else if (element.isInstanceMember) {
42 // Example: f() with 'f' bound to instance method.
43 return visitDynamicSend(node);
44 } else if (!element.isInstanceMember) {
45 // Example: A.f() or f() with 'f' bound to a static function.
46 // Also includes new A() or new A.named() which is treated like a
47 // static call to a factory.
48 return visitStaticSend(node);
49 } else {
50 internalError("Cannot generate code for send", node: node);
51 return null;
52 }
53 }
54 }
55
56 R visitSuperSend(Send node);
57 R visitOperatorSend(Send node);
58 R visitGetterSend(Send node);
59 R visitClosureSend(Send node);
60 R visitDynamicSend(Send node);
61 R visitStaticSend(Send node);
62
63 /// Visitor callback for a type literal.
64 R visitTypeLiteralSend(Send node);
65
66 /// Visitor callback for the class prefix of a static access, like `Foo` in
67 /// `Foo.staticField`.
68 // TODO(johnniwinther): Remove this when not needed by the dart backend.
69 R visitTypePrefixSend(Send node);
70
71 R visitAssert(Send node);
72
73 void internalError(String reason, {Node node});
74
75 R visitNode(Node node) {
76 internalError("Unhandled node", node: node);
77 return null;
78 }
79 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698