| OLD | NEW |
| 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 * The base type for all nodes in a dart abstract syntax tree. | 5 * The base type for all nodes in a dart abstract syntax tree. |
| 6 */ | 6 */ |
| 7 class Node { | 7 class Node { |
| 8 /** The source code this [Node] represents. */ | 8 /** The source code this [Node] represents. */ |
| 9 SourceSpan span; | 9 SourceSpan span; |
| 10 | 10 |
| 11 Node(this.span) {} | 11 Node(this.span) {} |
| 12 | 12 |
| 13 /** Classic double-dispatch visitor for implementing passes. */ | 13 /** Classic double-dispatch visitor for implementing passes. */ |
| 14 abstract visit(TreeVisitor visitor); | 14 abstract visit(TreeVisitor visitor); |
| 15 | 15 |
| 16 /** A multiline string showing the node and its children. */ | 16 /** A multiline string showing the node and its children. */ |
| 17 String toDebugString() { | 17 String toDebugString() { |
| 18 var to = new TreeOutput(); | 18 var to = new TreeOutput(); |
| 19 var tp = new TreePrinter(to); | 19 var tp = new TreePrinter(to); |
| 20 this.visit(tp); | 20 this.visit(tp); |
| 21 return to.buf.toString(); | 21 return to.buf.toString(); |
| 22 } | 22 } |
| 23 } | 23 } |
| 24 | 24 |
| 25 /** Represents all definitions allowed at the top-level. */ | 25 /** Represents all definitions allowed at the top-level. */ |
| 26 class Definition extends Statement { | 26 class Definition extends Statement { |
| 27 Definition(SourceSpan span): super(span) {} | 27 Definition(SourceSpan span): super(span) {} |
| 28 | 28 |
| 29 List<TypeParameter> get typeParameters() => null; | 29 List<TypeParameter> get typeParameters() => null; |
| 30 String get nativeType() => null; | |
| 31 } | 30 } |
| 32 | 31 |
| 33 /** The base type for statements. */ | 32 /** The base type for statements. */ |
| 34 class Statement extends Node { | 33 class Statement extends Node { |
| 35 Statement(SourceSpan span): super(span) {} | 34 Statement(SourceSpan span): super(span) {} |
| 36 } | 35 } |
| 37 | 36 |
| 38 /** The base type for expressions. */ | 37 /** The base type for expressions. */ |
| 39 class Expression extends Node { | 38 class Expression extends Node { |
| 40 Expression(SourceSpan span): super(span) {} | 39 Expression(SourceSpan span): super(span) {} |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 if (node != null) { | 121 if (node != null) { |
| 123 node.visit(printer); | 122 node.visit(printer); |
| 124 } else { | 123 } else { |
| 125 writeln('null'); | 124 writeln('null'); |
| 126 } | 125 } |
| 127 } | 126 } |
| 128 depth -= 1; | 127 depth -= 1; |
| 129 } | 128 } |
| 130 } | 129 } |
| 131 } | 130 } |
| OLD | NEW |