Cleaner printing of Java methods (to support gwt.jjs.traceMethod).

Review by: spoon (desk check)


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2172 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JMethodBody.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JMethodBody.java
index 60de63a..9cfa18d 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JMethodBody.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JMethodBody.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Google Inc.
+ * Copyright 2008 Google Inc.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  * use this file except in compliance with the License. You may obtain a copy of
@@ -25,16 +25,20 @@
  */
 public class JMethodBody extends JAbstractMethodBody {
 
-  public final ArrayList <JLocal>locals = new ArrayList<JLocal>();
-  private JBlock body;
+  public final ArrayList<JLocal> locals = new ArrayList<JLocal>();
+  private JBlock block;
 
   public JMethodBody(JProgram program, SourceInfo info) {
     super(program, info);
-    body = new JBlock(program, info);
+    block = new JBlock(program, info);
+  }
+
+  public JBlock getBlock() {
+    return block;
   }
 
   public List<JStatement> getStatements() {
-    return body.statements;
+    return block.statements;
   }
 
   @Override
@@ -45,7 +49,7 @@
   public void traverse(JVisitor visitor, Context ctx) {
     if (visitor.visit(this, ctx)) {
       visitor.accept(locals);
-      body = (JBlock) visitor.accept(body);
+      block = (JBlock) visitor.accept(block);
     }
     visitor.endVisit(this, ctx);
   }
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java
index f5d44be..5d3ddac 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007 Google Inc.
+ * Copyright 2008 Google Inc.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  * use this file except in compliance with the License. You may obtain a copy of
@@ -608,7 +608,8 @@
   @Override
   public boolean visit(JMethodBody x, Context ctx) {
     if (shouldPrintMethodBody()) {
-      return true;
+      accept(x.getBlock());
+      return false;
     } else {
       visitCollectionWithCommas(x.locals.iterator());
       return false;