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

Side by Side Diff: compiler/java/com/google/dart/compiler/ast/viz/TextWriter.java

Issue 9651004: Make SourceInfo a class, rename its menthods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweak for formatting, lazily create LainesInfo 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 package com.google.dart.compiler.ast.viz; 5 package com.google.dart.compiler.ast.viz;
6 6
7 import java.io.File; 7 import java.io.File;
8 import java.io.FileWriter; 8 import java.io.FileWriter;
9 import java.io.IOException; 9 import java.io.IOException;
10 10
11 import com.google.common.io.Closeables; 11 import com.google.common.io.Closeables;
12 import com.google.dart.compiler.ast.DartUnit; 12 import com.google.dart.compiler.ast.DartUnit;
13 13
14 /** 14 /**
15 * Write the AST in Text format. Output file is placed next to the JS file in th e output directory 15 * Write the AST in Text format. Output file is placed next to the JS file in th e output directory
16 */ 16 */
17 public class TextWriter extends ConsoleWriter { 17 public class TextWriter extends ConsoleWriter {
18 18
19 public TextWriter(String outputDir) { 19 public TextWriter(String outputDir) {
20 super(outputDir); 20 super(outputDir);
21 } 21 }
22 22
23 @Override 23 @Override
24 protected void startHook(DartUnit unit) { 24 protected void startHook(DartUnit unit) {
25 if (!isIgnored(unit)) { 25 if (!isIgnored(unit)) {
26 String txtFilePath = outputDir + File.separator + unit.getSource().getUri( ) 26 String txtFilePath = outputDir + File.separator + unit.getSourceInfo().get Source().getUri()
27 + ".ast.txt"; 27 + ".ast.txt";
28 makeParentDirs(txtFilePath); 28 makeParentDirs(txtFilePath);
29 try { 29 try {
30 //Set output to text file 30 //Set output to text file
31 out = new FileWriter(new File(txtFilePath)); 31 out = new FileWriter(new File(txtFilePath));
32 } catch (IOException e) { 32 } catch (IOException e) {
33 e.printStackTrace(); 33 e.printStackTrace();
34 } 34 }
35 } 35 }
36 } 36 }
37 37
38 @Override 38 @Override
39 protected void endHook(DartUnit unit) { 39 protected void endHook(DartUnit unit) {
40 if (!isIgnored(unit)) { 40 if (!isIgnored(unit)) {
41 try { 41 try {
42 Closeables.close(out, true); 42 Closeables.close(out, true);
43 } catch (IOException e) { 43 } catch (IOException e) {
44 System.err.println("Error closing AST output file"); 44 System.err.println("Error closing AST output file");
45 e.printStackTrace(); 45 e.printStackTrace();
46 } 46 }
47 } 47 }
48 } 48 }
49 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698