| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library trydart.interaction_manager; | 5 library trydart.interaction_manager; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 | 8 |
| 9 import 'dart:convert' show | 9 import 'dart:convert' show |
| 10 JSON; | 10 JSON; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 /// Called when notified about a project file changed (on the server). | 160 /// Called when notified about a project file changed (on the server). |
| 161 void onProjectFileFsEvent(MessageEvent e); | 161 void onProjectFileFsEvent(MessageEvent e); |
| 162 | 162 |
| 163 /// Called every [HEARTBEAT_INTERVAL]. | 163 /// Called every [HEARTBEAT_INTERVAL]. |
| 164 void onHeartbeat(Timer timer); | 164 void onHeartbeat(Timer timer); |
| 165 | 165 |
| 166 /// Called by [:window.onMessage.listen:]. | 166 /// Called by [:window.onMessage.listen:]. |
| 167 void onWindowMessage(MessageEvent event); | 167 void onWindowMessage(MessageEvent event); |
| 168 | 168 |
| 169 void onCompilationFailed(); | 169 void onCompilationFailed(String firstError); |
| 170 | 170 |
| 171 void onCompilationDone(); | 171 void onCompilationDone(); |
| 172 | 172 |
| 173 /// Called when a compilation is starting, but just before sending the | 173 /// Called when a compilation is starting, but just before sending the |
| 174 /// initiating message to the compiler isolate. | 174 /// initiating message to the compiler isolate. |
| 175 void compilationStarting(); | 175 void compilationStarting(); |
| 176 | 176 |
| 177 // TODO(ahe): Remove this from InteractionManager, but not from InitialState. | 177 // TODO(ahe): Remove this from InteractionManager, but not from InitialState. |
| 178 void consolePrintLine(line); | 178 void consolePrintLine(line); |
| 179 | 179 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 278 } |
| 279 | 279 |
| 280 void onProjectFileFsEvent(MessageEvent e) { | 280 void onProjectFileFsEvent(MessageEvent e) { |
| 281 return state.onProjectFileFsEvent(e); | 281 return state.onProjectFileFsEvent(e); |
| 282 } | 282 } |
| 283 | 283 |
| 284 void onHeartbeat(Timer timer) => state.onHeartbeat(timer); | 284 void onHeartbeat(Timer timer) => state.onHeartbeat(timer); |
| 285 | 285 |
| 286 void onWindowMessage(MessageEvent event) => state.onWindowMessage(event); | 286 void onWindowMessage(MessageEvent event) => state.onWindowMessage(event); |
| 287 | 287 |
| 288 void onCompilationFailed() => state.onCompilationFailed(); | 288 void onCompilationFailed(String firstError) { |
| 289 return state.onCompilationFailed(firstError); |
| 290 } |
| 289 | 291 |
| 290 void onCompilationDone() => state.onCompilationDone(); | 292 void onCompilationDone() => state.onCompilationDone(); |
| 291 | 293 |
| 292 void compilationStarting() => state.compilationStarting(); | 294 void compilationStarting() => state.compilationStarting(); |
| 293 | 295 |
| 294 void consolePrintLine(line) => state.consolePrintLine(line); | 296 void consolePrintLine(line) => state.consolePrintLine(line); |
| 295 | 297 |
| 296 void aboutToRun() => state.aboutToRun(); | 298 void aboutToRun() => state.aboutToRun(); |
| 297 | 299 |
| 298 void onIframeError(ErrorMessage message) => state.onIframeError(message); | 300 void onIframeError(ErrorMessage message) => state.onIframeError(message); |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 if (window.parent != window) { | 710 if (window.parent != window) { |
| 709 // Test support. | 711 // Test support. |
| 710 // TODO(ahe): Use '/' instead of '*' when Firefox is upgraded to version | 712 // TODO(ahe): Use '/' instead of '*' when Firefox is upgraded to version |
| 711 // 30 across build bots. Support for '/' was added in version 29, and we | 713 // 30 across build bots. Support for '/' was added in version 29, and we |
| 712 // support the two most recent versions. | 714 // support the two most recent versions. |
| 713 window.parent.postMessage('$line\n', '*'); | 715 window.parent.postMessage('$line\n', '*'); |
| 714 } | 716 } |
| 715 outputDiv.appendText('$line\n'); | 717 outputDiv.appendText('$line\n'); |
| 716 } | 718 } |
| 717 | 719 |
| 718 void onCompilationFailed() { | 720 void onCompilationFailed(String firstError) { |
| 719 consolePrintLine('Compilation failed.'); | 721 if (firstError == null) { |
| 722 consolePrintLine('Compilation failed.'); |
| 723 } else { |
| 724 consolePrintLine('Compilation failed: $firstError'); |
| 725 } |
| 720 } | 726 } |
| 721 | 727 |
| 722 void onCompilationDone() { | 728 void onCompilationDone() { |
| 723 context.isFirstCompile = false; | 729 context.isFirstCompile = false; |
| 724 context.elapsedCompilationTime.stop(); | 730 context.elapsedCompilationTime.stop(); |
| 725 Duration compilationDuration = context.elapsedCompilationTime.elapsed; | 731 Duration compilationDuration = context.elapsedCompilationTime.elapsed; |
| 726 context.elapsedCompilationTime.reset(); | 732 context.elapsedCompilationTime.reset(); |
| 727 print('Compilation took $compilationDuration.'); | 733 print('Compilation took $compilationDuration.'); |
| 728 if (context.compilerConsole.parent != null) { | 734 if (context.compilerConsole.parent != null) { |
| 729 context.compilerConsole.remove(); | 735 context.compilerConsole.remove(); |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 token = token.next; | 1337 token = token.next; |
| 1332 kind = token.kind; | 1338 kind = token.kind; |
| 1333 } | 1339 } |
| 1334 return token; | 1340 return token; |
| 1335 } | 1341 } |
| 1336 | 1342 |
| 1337 String extractQuote(String string) { | 1343 String extractQuote(String string) { |
| 1338 StringQuoting q = StringValidator.quotingFromString(string); | 1344 StringQuoting q = StringValidator.quotingFromString(string); |
| 1339 return (q.raw ? 'r' : '') + (q.quoteChar * q.leftQuoteLength); | 1345 return (q.raw ? 'r' : '') + (q.quoteChar * q.leftQuoteLength); |
| 1340 } | 1346 } |
| OLD | NEW |