Index: pkg/analyzer/lib/src/task/dart.dart |
diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart |
index 3b1e1a36a3af4e2240d2f4b9afe42f2b28f44bee..e5cca401c3382605190ea9ecc33d44686cd0f2d0 100644 |
--- a/pkg/analyzer/lib/src/task/dart.dart |
+++ b/pkg/analyzer/lib/src/task/dart.dart |
@@ -84,8 +84,8 @@ final ListResultDescriptor<AnalysisError> BUILD_LIBRARY_ERRORS = |
* |
* The result is only available for [LibrarySpecificUnit]s. |
*/ |
-final ListResultDescriptor< |
- ConstantEvaluationTarget> COMPILATION_UNIT_CONSTANTS = |
+final ListResultDescriptor<ConstantEvaluationTarget> |
+ COMPILATION_UNIT_CONSTANTS = |
new ListResultDescriptor<ConstantEvaluationTarget>( |
'COMPILATION_UNIT_CONSTANTS', null, |
cachingPolicy: ELEMENT_CACHING_POLICY); |
@@ -159,8 +159,8 @@ final ListResultDescriptor<AnalysisError> HINTS = |
* The result is only available for [VariableElement]s, and only when strong |
* mode is enabled. |
*/ |
-final ListResultDescriptor< |
- VariableElement> INFERABLE_STATIC_VARIABLE_DEPENDENCIES = |
+final ListResultDescriptor<VariableElement> |
+ INFERABLE_STATIC_VARIABLE_DEPENDENCIES = |
new ListResultDescriptor<VariableElement>( |
'INFERABLE_STATIC_VARIABLE_DEPENDENCIES', null); |
@@ -769,8 +769,9 @@ class BuildCompilationUnitElementTask extends SourceBasedAnalysisTask { |
ConstantFinder constantFinder = |
new ConstantFinder(context, source, librarySpecificUnit.library); |
unit.accept(constantFinder); |
- List<ConstantEvaluationTarget> constants = new List< |
- ConstantEvaluationTarget>.from(constantFinder.constantsToCompute); |
+ List<ConstantEvaluationTarget> constants = |
+ new List<ConstantEvaluationTarget>.from( |
+ constantFinder.constantsToCompute); |
// |
// Record outputs. |
// |
@@ -907,7 +908,7 @@ class BuildDirectiveElementsTask extends SourceBasedAnalysisTask { |
importElement.deferred = importDirective.deferredKeyword != null; |
importElement.combinators = _buildCombinators(importDirective); |
importElement.importedLibrary = importedLibrary; |
- _setDocRange(importElement, importDirective); |
+ _setDoc(importElement, importDirective); |
SimpleIdentifier prefixNode = directive.prefix; |
if (prefixNode != null) { |
importElement.prefixOffset = prefixNode.offset; |
@@ -949,7 +950,7 @@ class BuildDirectiveElementsTask extends SourceBasedAnalysisTask { |
exportElement.uri = exportDirective.uriContent; |
exportElement.combinators = _buildCombinators(exportDirective); |
exportElement.exportedLibrary = exportedLibrary; |
- _setDocRange(exportElement, exportDirective); |
+ _setDoc(exportElement, exportDirective); |
directive.element = exportElement; |
exports.add(exportElement); |
if (exportSourceKindMap[exportedSource] != SourceKind.LIBRARY) { |
@@ -990,12 +991,14 @@ class BuildDirectiveElementsTask extends SourceBasedAnalysisTask { |
} |
/** |
- * If the given [node] has a documentation comment, remember its range |
- * into the given [element]. |
+ * If the given [node] has a documentation comment, remember its content |
+ * and range into the given [element]. |
*/ |
- void _setDocRange(ElementImpl element, AnnotatedNode node) { |
+ void _setDoc(ElementImpl element, AnnotatedNode node) { |
Comment comment = node.documentationComment; |
if (comment != null && comment.isDocumentation) { |
+ element.documentationComment = |
+ comment.tokens.map((Token t) => t.lexeme).join('\n'); |
element.setDocRange(comment.offset, comment.length); |
} |
} |
@@ -1366,7 +1369,7 @@ class BuildLibraryElementTask extends SourceBasedAnalysisTask { |
_patchTopLevelAccessors(libraryElement); |
} |
if (libraryDirective != null) { |
- _setDocRange(libraryElement, libraryDirective); |
+ _setDoc(libraryElement, libraryDirective); |
} |
// |
// Record outputs. |
@@ -1454,12 +1457,14 @@ class BuildLibraryElementTask extends SourceBasedAnalysisTask { |
} |
/** |
- * If the given [node] has a documentation comment, remember its range |
- * into the given [element]. |
+ * If the given [node] has a documentation comment, remember its content |
+ * and range into the given [element]. |
*/ |
- void _setDocRange(ElementImpl element, AnnotatedNode node) { |
+ void _setDoc(ElementImpl element, AnnotatedNode node) { |
Comment comment = node.documentationComment; |
if (comment != null && comment.isDocumentation) { |
+ element.documentationComment = |
+ comment.tokens.map((Token t) => t.lexeme).join('\n'); |
element.setDocRange(comment.offset, comment.length); |
} |
} |
@@ -1888,7 +1893,8 @@ class ComputeInferableStaticVariableDependenciesTask |
* Return `true` if the given [variable] is a static variable whose type |
* should be inferred. |
*/ |
- bool _isInferableStatic(VariableElement variable) => variable.isStatic && |
+ bool _isInferableStatic(VariableElement variable) => |
+ variable.isStatic && |
variable.hasImplicitType && |
variable.initializer != null; |
@@ -2073,9 +2079,9 @@ class ComputePropagableVariableDependenciesTask |
*/ |
bool _isPropagable(VariableElement variable) => |
variable is PropertyInducingElement && |
- (variable.isConst || variable.isFinal) && |
- variable.hasImplicitType && |
- variable.initializer != null; |
+ (variable.isConst || variable.isFinal) && |
+ variable.hasImplicitType && |
+ variable.initializer != null; |
/** |
* Return a map from the names of the inputs of this kind of task to the task |