| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |