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

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

Issue 1686713002: Add support for redirectedConstructor to summaries. (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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.summarize_ast; 5 library serialization.summarize_ast;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/visitor.dart'; 8 import 'package:analyzer/dart/ast/visitor.dart';
9 import 'package:analyzer/src/generated/scanner.dart'; 9 import 'package:analyzer/src/generated/scanner.dart';
10 import 'package:analyzer/src/generated/utilities_dart.dart'; 10 import 'package:analyzer/src/generated/utilities_dart.dart';
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 if (node.name != null) { 778 if (node.name != null) {
779 b.name = node.name.name; 779 b.name = node.name.name;
780 b.nameOffset = node.name.offset; 780 b.nameOffset = node.name.offset;
781 } else { 781 } else {
782 b.nameOffset = node.returnType.offset; 782 b.nameOffset = node.returnType.offset;
783 } 783 }
784 b.parameters = node.parameters.parameters 784 b.parameters = node.parameters.parameters
785 .map((FormalParameter p) => p.accept(this)) 785 .map((FormalParameter p) => p.accept(this))
786 .toList(); 786 .toList();
787 b.kind = UnlinkedExecutableKind.constructor; 787 b.kind = UnlinkedExecutableKind.constructor;
788 b.isFactory = node.factoryKeyword != null; 788 if (node.factoryKeyword != null) {
789 b.isFactory = true;
790 if (node.redirectedConstructor != null) {
791 b.isRedirectedConstructor = true;
792 b.redirectedConstructor = new _ConstExprSerializer(this, null)
793 .serializeConstructorName(node.redirectedConstructor.type,
794 node.redirectedConstructor.name);
795 }
796 } else {
797 for (ConstructorInitializer initializer in node.initializers) {
798 if (initializer is RedirectingConstructorInvocation) {
799 b.isRedirectedConstructor = true;
800 b.redirectedConstructorName = initializer.constructorName?.name;
801 }
802 }
803 }
789 b.isConst = node.constKeyword != null; 804 b.isConst = node.constKeyword != null;
790 b.isExternal = node.externalKeyword != null; 805 b.isExternal = node.externalKeyword != null;
791 b.documentationComment = serializeDocumentation(node.documentationComment); 806 b.documentationComment = serializeDocumentation(node.documentationComment);
792 b.annotations = serializeAnnotations(node.metadata); 807 b.annotations = serializeAnnotations(node.metadata);
793 if (node.constKeyword != null) { 808 if (node.constKeyword != null) {
794 Set<String> constructorParameterNames = 809 Set<String> constructorParameterNames =
795 node.parameters.parameters.map((p) => p.identifier.name).toSet(); 810 node.parameters.parameters.map((p) => p.identifier.name).toSet();
796 b.constantInitializers = node.initializers 811 b.constantInitializers = node.initializers
797 .map((ConstructorInitializer initializer) => 812 .map((ConstructorInitializer initializer) =>
798 serializeConstructorInitializer(initializer, (Expression expr) { 813 serializeConstructorInitializer(initializer, (Expression expr) {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 /** 1022 /**
1008 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. 1023 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s.
1009 */ 1024 */
1010 class _TypeParameterScope extends _Scope { 1025 class _TypeParameterScope extends _Scope {
1011 /** 1026 /**
1012 * Get the number of [_ScopedTypeParameter]s defined in this 1027 * Get the number of [_ScopedTypeParameter]s defined in this
1013 * [_TypeParameterScope]. 1028 * [_TypeParameterScope].
1014 */ 1029 */
1015 int get length => _definedNames.length; 1030 int get length => _definedNames.length;
1016 } 1031 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/lib/src/summary/summarize_elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698