Use UnmodifiableListView to expose read-only lists.
Review URL: https://codereview.chromium.org//14394003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/stack_trace@21855 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkgs/stack_trace/lib/src/trace.dart b/pkgs/stack_trace/lib/src/trace.dart
index fa0c313..54f99db 100644
--- a/pkgs/stack_trace/lib/src/trace.dart
+++ b/pkgs/stack_trace/lib/src/trace.dart
@@ -4,6 +4,7 @@
library trace;
+import 'dart:collection';
import 'dart:uri';
import 'dart:math' as math;
@@ -13,7 +14,6 @@
/// A stack trace, comprised of a list of stack frames.
class Trace implements StackTrace {
- // TODO(nweiz): make this read-only once issue 8321 is fixed.
/// The stack frames that comprise this stack trace.
final List<Frame> frames;
@@ -63,7 +63,7 @@
/// Returns a new [Trace] comprised of [frames].
Trace(Iterable<Frame> frames)
- : frames = frames.toList();
+ : frames = new UnmodifiableListView<Frame>(frames.toList());
// TODO(nweiz): Keep track of which [Frame]s are part of the partial stack
// trace and only print them.