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

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

Issue 10920089: Generate a warning and a runtime error for calls to nonexistent static calls, getters and setters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove case for variable == null in handling of ForIn. Created 8 years, 3 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 class ResolvedVisitor<R> extends AbstractVisitor<R> { 5 class ResolvedVisitor<R> extends AbstractVisitor<R> {
6 TreeElements elements; 6 TreeElements elements;
7 7
8 ResolvedVisitor(this.elements); 8 ResolvedVisitor(this.elements);
9 9
10 R visitSend(Send node) { 10 R visitSend(Send node) {
11 if (node.isSuperCall) { 11 if (node.isSuperCall) {
12 return visitSuperSend(node); 12 return visitSuperSend(node);
13 } else if (node.isOperator) { 13 } else if (node.isOperator) {
14 return visitOperatorSend(node); 14 return visitOperatorSend(node);
15 } else if (node.isPropertyAccess) { 15 } else if (node.isPropertyAccess) {
16 return visitGetterSend(node); 16 return visitGetterSend(node);
17 } else if (Elements.isClosureSend(node, elements[node])) { 17 } else if (Elements.isClosureSend(node, elements[node])) {
18 return visitClosureSend(node); 18 return visitClosureSend(node);
19 } else { 19 } else {
20 Element element = elements[node]; 20 Element element = elements[node];
21 if (Element.isInvalid(element)) { 21 if (Element.isInvalid(element)) {
22 // Example: f() with 'f' unbound. 22 if (element == null || element.isInstanceMember()) {
ngeoffray 2012/09/05 11:46:45 How can the isInstanceMember happen?
karlklose 2012/09/05 14:53:42 It cannot.
23 // This can only happen inside an instance method. 23 // Example: f() with 'f' unbound.
24 return visitDynamicSend(node); 24 // This can only happen inside an instance method.
25 return visitDynamicSend(node);
26 } else {
27 return visitStaticSend(node);
28 }
25 } else if (element.kind == ElementKind.CLASS) { 29 } else if (element.kind == ElementKind.CLASS) {
26 internalError("Cannot generate code for send", node: node); 30 internalError("Cannot generate code for send", node: node);
27 } else if (element.isInstanceMember()) { 31 } else if (element.isInstanceMember()) {
28 // Example: f() with 'f' bound to instance method. 32 // Example: f() with 'f' bound to instance method.
29 return visitDynamicSend(node); 33 return visitDynamicSend(node);
30 } else if (element.kind === ElementKind.FOREIGN) { 34 } else if (element.kind === ElementKind.FOREIGN) {
31 return visitForeignSend(node); 35 return visitForeignSend(node);
32 } else if (!element.isInstanceMember()) { 36 } else if (!element.isInstanceMember()) {
33 // Example: A.f() or f() with 'f' bound to a static function. 37 // 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 38 // Also includes new A() or new A.named() which is treated like a
(...skipping 12 matching lines...) Expand all
47 abstract R visitDynamicSend(Send node); 51 abstract R visitDynamicSend(Send node);
48 abstract R visitForeignSend(Send node); 52 abstract R visitForeignSend(Send node);
49 abstract R visitStaticSend(Send node); 53 abstract R visitStaticSend(Send node);
50 54
51 abstract void internalError(String reason, [Node node]); 55 abstract void internalError(String reason, [Node node]);
52 56
53 R visitNode(Node node) { 57 R visitNode(Node node) {
54 internalError("Unhandled node", node); 58 internalError("Unhandled node", node);
55 } 59 }
56 } 60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698