| 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 analysis_server.src.get_handler; | 5 library analysis_server.src.get_handler; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import 'dart:math'; | 10 import 'dart:math'; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 SourceEntry entry = context.getReadableSourceEntryOrNull(source); | 282 SourceEntry entry = context.getReadableSourceEntryOrNull(source); |
| 283 if (entry == null) { | 283 if (entry == null) { |
| 284 buffer.write('<p>Not found.</p>'); | 284 buffer.write('<p>Not found.</p>'); |
| 285 return; | 285 return; |
| 286 } | 286 } |
| 287 CompilationUnit ast = (entry as DartEntry).anyParsedCompilationUnit; | 287 CompilationUnit ast = (entry as DartEntry).anyParsedCompilationUnit; |
| 288 if (ast == null) { | 288 if (ast == null) { |
| 289 buffer.write('<p>null</p>'); | 289 buffer.write('<p>null</p>'); |
| 290 return; | 290 return; |
| 291 } | 291 } |
| 292 ast.accept(new AstWriter(buffer)); | 292 AstWriter writer = new AstWriter(buffer); |
| 293 ast.accept(writer); |
| 294 if (writer.exceptions.isNotEmpty) { |
| 295 buffer.write('<h3>Exceptions while creating page</h3>'); |
| 296 for (CaughtException exception in writer.exceptions) { |
| 297 _writeException(buffer, exception); |
| 298 } |
| 299 } |
| 293 }); | 300 }); |
| 294 }); | 301 }); |
| 295 } | 302 } |
| 296 | 303 |
| 297 /** | 304 /** |
| 298 * Return a response containing information about a single source file in the | 305 * Return a response containing information about a single source file in the |
| 299 * cache. | 306 * cache. |
| 300 */ | 307 */ |
| 301 void _returnCacheEntry(HttpRequest request) { | 308 void _returnCacheEntry(HttpRequest request) { |
| 302 AnalysisServer analysisServer = _server.analysisServer; | 309 AnalysisServer analysisServer = _server.analysisServer; |
| (...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1473 } else if (value is Element) { | 1480 } else if (value is Element) { |
| 1474 String link = | 1481 String link = |
| 1475 _makeLink(ELEMENT_PATH, linkParameters, value.runtimeType.toString()); | 1482 _makeLink(ELEMENT_PATH, linkParameters, value.runtimeType.toString()); |
| 1476 buffer.write('<i>$link</i>'); | 1483 buffer.write('<i>$link</i>'); |
| 1477 } else { | 1484 } else { |
| 1478 buffer.write(HTML_ESCAPE.convert(value.toString())); | 1485 buffer.write(HTML_ESCAPE.convert(value.toString())); |
| 1479 buffer.write(' <i>(${value.runtimeType.toString()})</i>'); | 1486 buffer.write(' <i>(${value.runtimeType.toString()})</i>'); |
| 1480 } | 1487 } |
| 1481 } | 1488 } |
| 1482 } | 1489 } |
| OLD | NEW |