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

Side by Side 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: Address Kasper's comments Created 6 years, 8 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
« no previous file with comments | « dart/site/try/src/compilation.dart ('k') | dart/site/try/src/editor.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
5 library trydart.compilationUnit;
6
7 import 'dart:async' show
8 Stream,
9 StreamController;
10
11 class CompilationUnitData {
12 final String name;
13 String content;
14
15 CompilationUnitData(this.name, this.content);
16 }
17
18 class CompilationUnit extends CompilationUnitData {
19 // Extending [CompilationUnitData] allows this class to hide the storage
20 // allocated for [content] without introducing new names. The conventional
21 // way of acheiving this is to introduce a library-private field, but library
22 // privacy isn't without problems.
23
24 static StreamController<CompilationUnit> controller =
25 new StreamController<CompilationUnit>(sync: false);
26
27 static Stream<CompilationUnit> get onChanged => controller.stream;
28
29 CompilationUnit(String name, String content)
30 : super(name, content);
31
32 void set content(String newContent) {
33 if (content != newContent) {
34 super.content = newContent;
35 controller.add(this);
36 }
37 }
38 }
OLDNEW
« no previous file with comments | « dart/site/try/src/compilation.dart ('k') | dart/site/try/src/editor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698