| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer.src.context.context; | 5 library analyzer.src.context.context; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 } | 551 } |
| 552 _onSourcesChangedController.add(new SourcesChangedEvent(changeSet)); | 552 _onSourcesChangedController.add(new SourcesChangedEvent(changeSet)); |
| 553 return new ApplyChangesStatus(changeSet.addedSources.isNotEmpty || | 553 return new ApplyChangesStatus(changeSet.addedSources.isNotEmpty || |
| 554 changeSet.changedContents.isNotEmpty || | 554 changeSet.changedContents.isNotEmpty || |
| 555 changeSet.deletedSources.isNotEmpty || | 555 changeSet.deletedSources.isNotEmpty || |
| 556 changedSources.isNotEmpty || | 556 changedSources.isNotEmpty || |
| 557 removedSources.isNotEmpty); | 557 removedSources.isNotEmpty); |
| 558 } | 558 } |
| 559 | 559 |
| 560 @override | 560 @override |
| 561 String computeDocumentationComment(Element element) { | 561 String computeDocumentationComment(Element element) => |
| 562 if (element == null) { | 562 element?.documentationComment; |
| 563 return null; | |
| 564 } | |
| 565 Source source = element.source; | |
| 566 if (source == null) { | |
| 567 return null; | |
| 568 } | |
| 569 SourceRange docRange = element.docRange; | |
| 570 if (docRange == null) { | |
| 571 return null; | |
| 572 } | |
| 573 String code = getContents(source).data; | |
| 574 String comment = code.substring(docRange.offset, docRange.end); | |
| 575 return comment.replaceAll('\r\n', '\n'); | |
| 576 } | |
| 577 | 563 |
| 578 @override | 564 @override |
| 579 List<AnalysisError> computeErrors(Source source) { | 565 List<AnalysisError> computeErrors(Source source) { |
| 580 String name = source.shortName; | 566 String name = source.shortName; |
| 581 if (AnalysisEngine.isHtmlFileName(name)) { | 567 if (AnalysisEngine.isHtmlFileName(name)) { |
| 582 return computeResult(source, HTML_ERRORS); | 568 return computeResult(source, HTML_ERRORS); |
| 583 } | 569 } |
| 584 return computeResult(source, DART_ERRORS); | 570 return computeResult(source, DART_ERRORS); |
| 585 } | 571 } |
| 586 | 572 |
| (...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2018 } | 2004 } |
| 2019 DartSdk sdk = factory.dartSdk; | 2005 DartSdk sdk = factory.dartSdk; |
| 2020 if (sdk == null) { | 2006 if (sdk == null) { |
| 2021 throw new IllegalArgumentException( | 2007 throw new IllegalArgumentException( |
| 2022 "The source factory for an SDK analysis context must have a DartUriRes
olver"); | 2008 "The source factory for an SDK analysis context must have a DartUriRes
olver"); |
| 2023 } | 2009 } |
| 2024 return new AnalysisCache( | 2010 return new AnalysisCache( |
| 2025 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); | 2011 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); |
| 2026 } | 2012 } |
| 2027 } | 2013 } |
| OLD | NEW |