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

Unified Diff: dart/site/try/src/compilation_unit.dart

Issue 214513005: Add CompilationUnit abstraction for tracking "project files". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: dart/site/try/src/compilation_unit.dart
diff --git a/dart/site/try/src/compilation_unit.dart b/dart/site/try/src/compilation_unit.dart
new file mode 100644
index 0000000000000000000000000000000000000000..fab8052690311126ab9e254d27a27221adfbae93
--- /dev/null
+++ b/dart/site/try/src/compilation_unit.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2013, 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.
+
+library trydart.compilationUnit;
+
+import 'dart:async' show
+ Stream,
+ StreamController;
+
lukechurch 2014/03/27 16:08:23 This seems on first reading like a slightly odd pa
ahe 2014/03/27 23:32:34 It creates a private field without creating an abs
+class CompilationUnitData {
+ final String name;
+ String content;
+
+ CompilationUnitData(this.name, this.content);
+}
+
+class CompilationUnit extends CompilationUnitData {
+ static StreamController<CompilationUnit> controller =
+ new StreamController<CompilationUnit>(sync: false);
+
+ static Stream<CompilationUnit> get onChanged => controller.stream;
+
+ CompilationUnit(String name, String content)
+ : super(name, content);
+
+ void set content(String newContent) {
+ if (content != newContent) {
+ super.content = newContent;
+ controller.add(this);
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698