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

Unified Diff: lib/compiler/implementation/tree/nodes.dart

Issue 10441044: Refactor common logic of SsaBuilder.visitSend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/tree/nodes.dart
diff --git a/lib/compiler/implementation/tree/nodes.dart b/lib/compiler/implementation/tree/nodes.dart
index f5aa5adcded14326fc9d60e49603f1ca1b960fd2..488da5c1f1bc80dfc4c1a44ab4771f386a0351b8 100644
--- a/lib/compiler/implementation/tree/nodes.dart
+++ b/lib/compiler/implementation/tree/nodes.dart
@@ -293,6 +293,54 @@ class Send extends Expression {
assert(receiver === null);
return new Send(newReceiver, selector, argumentsNode);
}
+
+ analyse([
ahe 2012/05/29 10:24:00 It concerns that I don't see how this can avoid cr
Anton Muhin 2012/05/31 18:56:38 Done.
+ bool methodInterceptionEnabled,
+ TreeElements elements,
+ superRead(Send node),
+ superSend(Send node),
+ operatorSend(Send node),
+ getterSend(Send node),
+ closureSend(Send node),
+ dynamicSend(Send node),
+ foreignSend(Send node),
+ staticSend(Send node),
+ internalError(String reason)]) {
+ if (isSuperCall) {
+ if (isPropertyAccess) {
+ return superRead(this);
+ } else {
+ return superSend(this);
+ }
+ } else if (isOperator && methodInterceptionEnabled) {
+ return operatorSend(this);
+ } else if (isPropertyAccess) {
+ return getterSend(this);
+ } else if (Elements.isClosureSend(this, elements)) {
+ return closureSend(this);
+ } else {
+ Element element = elements[this];
+ if (element === null) {
+ // Example: f() with 'f' unbound.
+ // This can only happen inside an instance method.
+ return dynamicSend(this);
+ } else if (element.kind == ElementKind.CLASS) {
+ internalError("Cannot generate code for send");
+ } else if (element.isInstanceMember()) {
+ // Example: f() with 'f' bound to instance method.
+ return dynamicSend(this);
+ } else if (element.kind === ElementKind.FOREIGN) {
+ return foreignSend(this);
+ } else if (!element.isInstanceMember()) {
+ // Example: A.f() or f() with 'f' bound to a static function.
+ // Also includes new A() or new A.named() which is treated like a
+ // static call to a factory.
+ return staticSend(this);
+ } else {
+ internalError("Cannot generate code for send");
+ }
+ }
+ }
}
class Postfix extends NodeList {

Powered by Google App Engine
This is Rietveld 408576698