Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 | |
|
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
| |
| 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 static StreamController<CompilationUnit> controller = | |
| 20 new StreamController<CompilationUnit>(sync: false); | |
| 21 | |
| 22 static Stream<CompilationUnit> get onChanged => controller.stream; | |
| 23 | |
| 24 CompilationUnit(String name, String content) | |
| 25 : super(name, content); | |
| 26 | |
| 27 void set content(String newContent) { | |
| 28 if (content != newContent) { | |
| 29 super.content = newContent; | |
| 30 controller.add(this); | |
| 31 } | |
| 32 } | |
| 33 } | |
| OLD | NEW |