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

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

Issue 8566019: Added support for dumping AST to console, text file or dot file (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month 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/ASTWriterFactory.java
===================================================================
--- compiler/java/com/google/dart/compiler/ast/viz/ASTWriterFactory.java (revision 0)
+++ compiler/java/com/google/dart/compiler/ast/viz/ASTWriterFactory.java (revision 0)
@@ -0,0 +1,24 @@
+// Copyright (c) 2011, 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.CompilerConfiguration;
+import com.google.dart.compiler.CommandLineOptions.CompilerOptions;
+
+public class ASTWriterFactory {
+ public static BaseASTWriter create(CompilerConfiguration config) {
+ String astFormat = config.getCompilerOptions().dumpAST();
+ CompilerOptions compilerOptions = config.getCompilerOptions();
+ String outDir = compilerOptions.getWorkDirectory().getAbsolutePath();
+ if ("console".equals(astFormat)) {
+ return new ConsoleWriter(outDir);
+ } else if ("text".equals(astFormat)) {
+ return new TextWriter(outDir);
+ } else if ("dot".equals(astFormat)) {
+ return new DotWriter(outDir);
+ }
+ return null;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698