| 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/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart' show DartType; | 10 import 'package:analyzer/dart/element/type.dart' show DartType; |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 } | 792 } |
| 793 | 793 |
| 794 /** | 794 /** |
| 795 * Serialize a generic function type. | 795 * Serialize a generic function type. |
| 796 */ | 796 */ |
| 797 EntityRefBuilder serializeGenericFunctionType(GenericFunctionType node) { | 797 EntityRefBuilder serializeGenericFunctionType(GenericFunctionType node) { |
| 798 _TypeParameterScope typeParameterScope = new _TypeParameterScope(); | 798 _TypeParameterScope typeParameterScope = new _TypeParameterScope(); |
| 799 scopes.add(typeParameterScope); | 799 scopes.add(typeParameterScope); |
| 800 EntityRefBuilder b = new EntityRefBuilder(); | 800 EntityRefBuilder b = new EntityRefBuilder(); |
| 801 b.entityKind = EntityRefKind.genericFunctionType; | 801 b.entityKind = EntityRefKind.genericFunctionType; |
| 802 b.typeParameters = |
| 803 serializeTypeParameters(node.typeParameters, typeParameterScope); |
| 802 b.syntheticReturnType = node.returnType == null | 804 b.syntheticReturnType = node.returnType == null |
| 803 ? serializeDynamic() | 805 ? serializeDynamic() |
| 804 : serializeTypeName(node.returnType); | 806 : serializeTypeName(node.returnType); |
| 805 b.typeParameters = | |
| 806 serializeTypeParameters(node.typeParameters, typeParameterScope); | |
| 807 b.syntheticParams = node.parameters.parameters | 807 b.syntheticParams = node.parameters.parameters |
| 808 .map((FormalParameter p) => p.accept(this) as UnlinkedParamBuilder) | 808 .map((FormalParameter p) => p.accept(this) as UnlinkedParamBuilder) |
| 809 .toList(); | 809 .toList(); |
| 810 scopes.removeLast(); | 810 scopes.removeLast(); |
| 811 return b; | 811 return b; |
| 812 } | 812 } |
| 813 | 813 |
| 814 /** | 814 /** |
| 815 * If the given [expression] is not `null`, serialize it as an | 815 * If the given [expression] is not `null`, serialize it as an |
| 816 * [UnlinkedExecutableBuilder], otherwise return `null`. | 816 * [UnlinkedExecutableBuilder], otherwise return `null`. |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 /** | 1486 /** |
| 1487 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. | 1487 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. |
| 1488 */ | 1488 */ |
| 1489 class _TypeParameterScope extends _Scope { | 1489 class _TypeParameterScope extends _Scope { |
| 1490 /** | 1490 /** |
| 1491 * Get the number of [_ScopedTypeParameter]s defined in this | 1491 * Get the number of [_ScopedTypeParameter]s defined in this |
| 1492 * [_TypeParameterScope]. | 1492 * [_TypeParameterScope]. |
| 1493 */ | 1493 */ |
| 1494 int get length => _definedNames.length; | 1494 int get length => _definedNames.length; |
| 1495 } | 1495 } |
| OLD | NEW |