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

Unified Diff: sdk/lib/_internal/compiler/implementation/dart_backend/tree_tracer.dart

Issue 278823002: dart2dart: Method and constructor calls in new backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Formatting and copyright notice. Created 6 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: sdk/lib/_internal/compiler/implementation/dart_backend/tree_tracer.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/tree_tracer.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/tree_tracer.dart
index a9b35c0d30c5a3c2d0ed2397d0c04204dc1c9d5f..b1f4fe0b7de59a6959fb35bf167a45905b32803e 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/tree_tracer.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/tree_tracer.dart
@@ -1,3 +1,7 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
library dart_backend.tracer;
import 'dart:async' show EventSink;
@@ -43,6 +47,8 @@ class BlockCollector extends Visitor {
visitVariable(Variable node) {}
visitInvokeStatic(InvokeStatic node) {}
+ visitInvokeMethod(InvokeMethod node) {}
+ visitInvokeConstructor(InvokeConstructor node) {}
visitConstant(Constant node) {}
visitLabeledStatement(LabeledStatement node) {
@@ -162,6 +168,14 @@ class TreeTracer extends TracerUtil with Visitor {
printStatement(name, "let $name = $rhs");
}
+ visitInvokeMethod(InvokeMethod node) {
+ printStatement(null, expr(node));
+ }
+
+ visitInvokeConstructor(InvokeConstructor node) {
+ printStatement(null, expr(node));
+ }
+
visitReturn(Return node) {
printStatement(null, "return ${expr(node.value)}");
}
@@ -201,6 +215,24 @@ class SubexpressionVisitor extends Visitor<String, String> {
return "$head($args)";
}
+ String visitInvokeMethod(InvokeMethod node) {
+ String receiver = node.receiver.accept(this);
+ String name = node.selector.name;
+ String args = node.arguments.map((e) => e.accept(this)).join(', ');
+ return "$receiver.$name($args)";
+ }
+
+ String visitInvokeConstructor(InvokeConstructor node) {
+ String callName;
+ if (node.target.name.isEmpty) {
+ callName = '${node.type}';
+ } else {
+ callName = '${node.type}.${node.target.name}';
+ }
+ String args = node.arguments.map(visitExpression).join(', ');
+ return "new $callName($args)";
+ }
+
String visitConstant(Constant node) {
return "${node.value}";
}

Powered by Google App Engine
This is Rietveld 408576698