Index: pkg/front_end/lib/src/fasta/scope.dart |
diff --git a/pkg/front_end/lib/src/fasta/scope.dart b/pkg/front_end/lib/src/fasta/scope.dart |
index c1b884cb0225388dd854264c7585cc3cdf207aad..c477ba95b303735a04e833cdc9f809eb24970cf6 100644 |
--- a/pkg/front_end/lib/src/fasta/scope.dart |
+++ b/pkg/front_end/lib/src/fasta/scope.dart |
@@ -164,6 +164,28 @@ class Scope { |
void forEach(f(String name, Builder member)) { |
local.forEach(f); |
} |
+ |
+ String get debugString { |
+ StringBuffer buffer = new StringBuffer(); |
+ int nestingLevel = writeOn(buffer); |
+ for (int i = nestingLevel; i >= 0; i--) { |
+ buffer.writeln("${' ' * i}}"); |
+ } |
+ return "$buffer"; |
+ } |
+ |
+ int writeOn(StringSink sink) { |
+ int nestingLevel = (parent?.writeOn(sink) ?? -1) + 1; |
+ String indent = " " * nestingLevel; |
+ sink.writeln("$indent{"); |
+ local.forEach((String name, Builder member) { |
+ sink.writeln("$indent $name"); |
+ }); |
+ setters.forEach((String name, Builder member) { |
+ sink.writeln("$indent $name="); |
+ }); |
+ return nestingLevel; |
+ } |
} |
abstract class ProblemBuilder extends Builder { |