Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: pkg/analyzer/lib/src/summary/summarize_elements.dart

Issue 1677683002: Include default parameter values into summary. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 serialization.elements; 5 library serialization.elements;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/dart/element/type.dart'; 8 import 'package:analyzer/dart/element/type.dart';
9 import 'package:analyzer/src/dart/element/element.dart'; 9 import 'package:analyzer/src/dart/element/element.dart';
10 import 'package:analyzer/src/dart/element/type.dart'; 10 import 'package:analyzer/src/dart/element/type.dart';
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 if (type is FunctionType) { 601 if (type is FunctionType) {
602 b.isFunctionTyped = true; 602 b.isFunctionTyped = true;
603 b.type = serializeTypeRef(type.returnType, parameter); 603 b.type = serializeTypeRef(type.returnType, parameter);
604 b.parameters = type.parameters 604 b.parameters = type.parameters
605 .map((parameter) => serializeParam(parameter, context)) 605 .map((parameter) => serializeParam(parameter, context))
606 .toList(); 606 .toList();
607 } else { 607 } else {
608 b.type = serializeTypeRef(type, context); 608 b.type = serializeTypeRef(type, context);
609 } 609 }
610 } 610 }
611 if (parameter is ConstVariableElement) {
612 ConstVariableElement constParameter = parameter as ConstVariableElement;
613 Expression initializer = constParameter.constantInitializer;
614 if (initializer != null) {
615 b.defaultValue = serializeConstExpr(initializer);
616 }
617 }
611 return b; 618 return b;
612 } 619 }
613 620
614 /** 621 /**
615 * Serialize the given [prefix] into an index into the references table. 622 * Serialize the given [prefix] into an index into the references table.
616 */ 623 */
617 int serializePrefix(PrefixElement element) { 624 int serializePrefix(PrefixElement element) {
618 return referenceMap.putIfAbsent(element, () { 625 return referenceMap.putIfAbsent(element, () {
619 assert(unlinkedReferences.length == linkedReferences.length); 626 assert(unlinkedReferences.length == linkedReferences.length);
620 int index = unlinkedReferences.length; 627 int index = unlinkedReferences.length;
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 exportNames.add(new LinkedExportNameBuilder( 1161 exportNames.add(new LinkedExportNameBuilder(
1155 name: name, 1162 name: name,
1156 dependency: serializeDependency(dependentLibrary), 1163 dependency: serializeDependency(dependentLibrary),
1157 unit: unit, 1164 unit: unit,
1158 kind: kind)); 1165 kind: kind));
1159 } 1166 }
1160 pb.exportNames = exportNames; 1167 pb.exportNames = exportNames;
1161 return pb; 1168 return pb;
1162 } 1169 }
1163 } 1170 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_ast.dart ('k') | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698