| Index: pkg/analyzer/lib/src/summary/summarize_elements.dart
|
| diff --git a/pkg/analyzer/lib/src/summary/summarize_elements.dart b/pkg/analyzer/lib/src/summary/summarize_elements.dart
|
| index b63128786de196a860b13bf8b3e222d9b878eb29..c30393678c034d307bdea3e6d0acbdf3ff8e6778 100644
|
| --- a/pkg/analyzer/lib/src/summary/summarize_elements.dart
|
| +++ b/pkg/analyzer/lib/src/summary/summarize_elements.dart
|
| @@ -38,7 +38,10 @@ ReferenceKind _getReferenceKind(Element element) {
|
| } else if (element is ConstructorElement) {
|
| return ReferenceKind.constructor;
|
| } else if (element is FunctionElement) {
|
| - return ReferenceKind.topLevelFunction;
|
| + if (element.enclosingElement is CompilationUnitElement) {
|
| + return ReferenceKind.topLevelFunction;
|
| + }
|
| + return ReferenceKind.function;
|
| } else if (element is FunctionTypeAliasElement) {
|
| return ReferenceKind.typedef;
|
| } else if (element is PropertyAccessorElement) {
|
| @@ -519,7 +522,10 @@ class _CompilationUnitSerializer {
|
| UnlinkedExecutableBuilder b = new UnlinkedExecutableBuilder();
|
| b.name = executableElement.name;
|
| b.nameOffset = executableElement.nameOffset;
|
| - if (executableElement is! ConstructorElement) {
|
| + if (executableElement.enclosingElement is VariableElement) {
|
| + // TODO(scheglov) remove this check and serialize initializer types
|
| + // Note that for code like `var v = null` w need to support Bottom.
|
| + } else if (executableElement is! ConstructorElement) {
|
| if (!executableElement.hasImplicitReturnType) {
|
| b.returnType = serializeTypeRef(
|
| executableElement.type.returnType, executableElement);
|
| @@ -700,6 +706,10 @@ class _CompilationUnitSerializer {
|
| b.defaultValue = serializeConstExpr(initializer);
|
| }
|
| }
|
| + // TODO(scheglov) VariableMember.initializer is not implemented
|
| + if (parameter is! VariableMember && parameter.initializer != null) {
|
| + b.initializer = serializeExecutable(parameter.initializer);
|
| + }
|
| {
|
| SourceRange visibleRange = parameter.visibleRange;
|
| if (visibleRange != null) {
|
| @@ -913,6 +923,10 @@ class _CompilationUnitSerializer {
|
| b.visibleLength = visibleRange.length;
|
| }
|
| }
|
| + // TODO(scheglov) VariableMember.initializer is not implemented
|
| + if (variable is! VariableMember && variable.initializer != null) {
|
| + b.initializer = serializeExecutable(variable.initializer);
|
| + }
|
| return b;
|
| }
|
|
|
|
|