Chromium Code Reviews| 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; | 5 library analysis.server; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 548 // if library has not been resolved yet, the unit will be resolved later | 548 // if library has not been resolved yet, the unit will be resolved later |
| 549 Source librarySource = librarySources[0]; | 549 Source librarySource = librarySources[0]; |
| 550 if (context.getLibraryElement(librarySource) == null) { | 550 if (context.getLibraryElement(librarySource) == null) { |
| 551 return null; | 551 return null; |
| 552 } | 552 } |
| 553 // if library has been already resolved, resolve unit | 553 // if library has been already resolved, resolve unit |
| 554 return context.resolveCompilationUnit2(unitSource, librarySource); | 554 return context.resolveCompilationUnit2(unitSource, librarySource); |
| 555 } | 555 } |
| 556 | 556 |
| 557 /** | 557 /** |
| 558 * Returns all the [AnalysisErrorInfo] for [file]. | |
| 559 * | |
| 560 * May return `null`. | |
| 561 */ | |
| 562 AnalysisErrorInfo getErrors(String file) { | |
| 563 // prepare AnalysisContext | |
| 564 AnalysisContext context = getAnalysisContext(file); | |
| 565 if (context == null) { | |
| 566 return null; | |
|
Paul Berry
2014/07/22 20:22:06
Does this mean that the result will be {..., "resu
scheglov
2014/07/22 20:31:31
It is OK for "edit.getFixes" though.
Paul Berry
2014/07/22 20:41:43
Oh, ok. I was confused because the method name so
scheglov
2014/07/22 20:53:08
Done.
| |
| 567 } | |
| 568 // get errors for the file | |
| 569 Source source = getSource(file); | |
| 570 return context.getErrors(source); | |
|
Paul Berry
2014/07/22 20:22:06
Judging from the implementation in AnalysisContext
scheglov
2014/07/22 20:31:31
It's not an implementation of the "analysis.getErr
| |
| 571 } | |
| 572 | |
| 573 /** | |
| 558 * Returns resolved [CompilationUnit]s of the Dart file with the given [path]. | 574 * Returns resolved [CompilationUnit]s of the Dart file with the given [path]. |
| 559 * | 575 * |
| 560 * May be empty, but not `null`. | 576 * May be empty, but not `null`. |
| 561 */ | 577 */ |
| 562 List<CompilationUnit> getResolvedCompilationUnits(String path) { | 578 List<CompilationUnit> getResolvedCompilationUnits(String path) { |
| 563 List<CompilationUnit> units = <CompilationUnit>[]; | 579 List<CompilationUnit> units = <CompilationUnit>[]; |
| 564 // prepare AnalysisContext | 580 // prepare AnalysisContext |
| 565 AnalysisContext context = getAnalysisContext(path); | 581 AnalysisContext context = getAnalysisContext(path); |
| 566 if (context == null) { | 582 if (context == null) { |
| 567 return units; | 583 return units; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 657 /** | 673 /** |
| 658 * An enumeration of the services provided by the server domain. | 674 * An enumeration of the services provided by the server domain. |
| 659 */ | 675 */ |
| 660 class ServerService extends Enum2<ServerService> { | 676 class ServerService extends Enum2<ServerService> { |
| 661 static const ServerService STATUS = const ServerService('STATUS', 0); | 677 static const ServerService STATUS = const ServerService('STATUS', 0); |
| 662 | 678 |
| 663 static const List<ServerService> VALUES = const [STATUS]; | 679 static const List<ServerService> VALUES = const [STATUS]; |
| 664 | 680 |
| 665 const ServerService(String name, int ordinal) : super(name, ordinal); | 681 const ServerService(String name, int ordinal) : super(name, ordinal); |
| 666 } | 682 } |
| OLD | NEW |