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

Unified Diff: compiler/java/com/google/dart/compiler/ast/viz/ConsoleWriter.java

Issue 9692006: Remove AST dumps, useless for Editor (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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: compiler/java/com/google/dart/compiler/ast/viz/ConsoleWriter.java
diff --git a/compiler/java/com/google/dart/compiler/ast/viz/ConsoleWriter.java b/compiler/java/com/google/dart/compiler/ast/viz/ConsoleWriter.java
deleted file mode 100644
index 961cb017fa9984c7e6f0ea558f1fe4816720c316..0000000000000000000000000000000000000000
--- a/compiler/java/com/google/dart/compiler/ast/viz/ConsoleWriter.java
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2012, 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.
-
-package com.google.dart.compiler.ast.viz;
-
-import com.google.dart.compiler.ast.DartNode;
-import com.google.dart.compiler.ast.DartUnit;
-
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Write the AST in to System out.
- */
-public class ConsoleWriter extends BaseASTWriter {
- Map<DartNode, Integer> indentMap;
- OutputStreamWriter out;
-
- public ConsoleWriter(String outputDir) {
- super(outputDir);
- this.indentMap = new HashMap<DartNode, Integer>();
- out = new OutputStreamWriter(System.out);
- }
-
- @Override
- protected void startHook(DartUnit unit) {
- // Do nothing
- }
-
- @Override
- protected void endHook(DartUnit unit) {
- try {
- out.flush();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- protected void write(String nodeType, DartNode node, String data) {
- StringBuffer sb = new StringBuffer();
- int indent = 0;
- DartNode parent = node.getParent();
- if (parent != null) {
- indent = this.indentMap.get(parent) + 1;
- }
- for (int i = 0; i < indent; i++) {
- sb.append('\t');
- }
- try {
- out.write(sb.toString());
- out.write(nodeType);
- if (!data.equals("")) {
- out.write(" (" + data + ")");
- }
- out.write('\n');
- } catch (IOException e) {
-
- }
- }
-
- @Override
- protected void visitChildren(DartNode node) {
- // Setup Indentation
- DartNode parent = node.getParent();
- if (parent == null) { // DartUnit's parent is null
- this.indentMap.put(node, 0);
- } else {
- int parentIndent = this.indentMap.get(parent);
- this.indentMap.put(node, parentIndent + 1);
- }
- super.visitChildren(node);
- }
-
-}

Powered by Google App Engine
This is Rietveld 408576698