| Index: dart/site/try/src/interaction_manager.dart
|
| diff --git a/dart/site/try/src/interaction_manager.dart b/dart/site/try/src/interaction_manager.dart
|
| index 4fc39a9f836ff8a9c6a470aba274e4cf9496fff4..7f9e44c3f1ba633f8139b7ecab78abf3c0a27b6a 100644
|
| --- a/dart/site/try/src/interaction_manager.dart
|
| +++ b/dart/site/try/src/interaction_manager.dart
|
| @@ -108,6 +108,9 @@ abstract class InteractionManager {
|
|
|
| InteractionManager.internal();
|
|
|
| + // TODO(ahe): Remove this.
|
| + Set<AnchorElement> get oldDiagnostics;
|
| +
|
| void onInput(Event event);
|
|
|
| // TODO(ahe): Rename to onKeyDown (as it is called in response to keydown
|
| @@ -134,6 +137,12 @@ abstract class InteractionManager {
|
|
|
| /// Called by [:window.onMessage.listen:].
|
| void onMessage(MessageEvent event);
|
| +
|
| + void onCompilationDone();
|
| +
|
| + /// Called when a compilation is starting, but just before sending the
|
| + /// initiating message to the compiler isolate.
|
| + void compilationStarting();
|
| }
|
|
|
| /**
|
| @@ -160,6 +169,8 @@ class InteractionContext extends InteractionManager {
|
|
|
| Completer<String> completeSaveOperation;
|
|
|
| + final Set<AnchorElement> oldDiagnostics = new Set<AnchorElement>();
|
| +
|
| InteractionContext()
|
| : super.internal() {
|
| state = new InitialState(this);
|
| @@ -219,11 +230,20 @@ class InteractionContext extends InteractionManager {
|
| void onHeartbeat(Timer timer) => state.onHeartbeat(timer);
|
|
|
| void onMessage(MessageEvent event) => state.onMessage(event);
|
| +
|
| + void onCompilationDone() => state.onCompilationDone();
|
| +
|
| + void compilationStarting() => state.compilationStarting();
|
| }
|
|
|
| abstract class InteractionState implements InteractionManager {
|
| InteractionContext get context;
|
|
|
| + // TODO(ahe): Remove this.
|
| + Set<AnchorElement> get oldDiagnostics {
|
| + throw 'Use context.oldDiagnostics instead';
|
| + }
|
| +
|
| void set state(InteractionState newState);
|
|
|
| void onStateChanged(InteractionState previous) {
|
| @@ -584,6 +604,23 @@ class InitialState extends InteractionState {
|
| void consolePrintLine(data) {
|
| outputDiv.appendText('$data\n');
|
| }
|
| +
|
| + void onCompilationDone() {
|
| + for (AnchorElement diagnostic in context.oldDiagnostics) {
|
| + if (diagnostic.parent != null) {
|
| + // Problem fixed, remove the diagnostic.
|
| + diagnostic.replaceWith(new Text(getText(diagnostic)));
|
| + }
|
| + }
|
| + context.oldDiagnostics.clear();
|
| + observer.takeRecords(); // Discard mutations.
|
| + }
|
| +
|
| + void compilationStarting() {
|
| + context.oldDiagnostics
|
| + ..clear()
|
| + ..addAll(mainEditorPane.querySelectorAll('a.diagnostic'));
|
| + }
|
| }
|
|
|
| Future<String> getString(uri) {
|
|
|