| 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * Instances of this class keep track of intermediate state during | 23 * Instances of this class keep track of intermediate state during |
| 24 * serialization of a single constant [Expression]. | 24 * serialization of a single constant [Expression]. |
| 25 */ | 25 */ |
| 26 class _ConstExprSerializer extends AbstractConstExprSerializer { | 26 class _ConstExprSerializer extends AbstractConstExprSerializer { |
| 27 final _SummarizeAstVisitor visitor; | 27 final _SummarizeAstVisitor visitor; |
| 28 | 28 |
| 29 _ConstExprSerializer(this.visitor); | 29 _ConstExprSerializer(this.visitor); |
| 30 | 30 |
| 31 @override |
| 32 EntityRefBuilder serializeConstructorName(ConstructorName constructor) { |
| 33 EntityRefBuilder typeBuilder = serializeType(constructor.type); |
| 34 if (constructor.name == null) { |
| 35 return typeBuilder; |
| 36 } else { |
| 37 String name = constructor.name.name; |
| 38 int nameRef = visitor.serializeReference(typeBuilder.reference, name); |
| 39 return new EntityRefBuilder(reference: nameRef); |
| 40 } |
| 41 } |
| 42 |
| 31 EntityRefBuilder serializeIdentifier(Identifier identifier) { | 43 EntityRefBuilder serializeIdentifier(Identifier identifier) { |
| 32 EntityRefBuilder b = new EntityRefBuilder(); | 44 EntityRefBuilder b = new EntityRefBuilder(); |
| 33 if (identifier is SimpleIdentifier) { | 45 if (identifier is SimpleIdentifier) { |
| 34 b.reference = visitor.serializeReference(null, identifier.name); | 46 b.reference = visitor.serializeReference(null, identifier.name); |
| 35 } else if (identifier is PrefixedIdentifier) { | 47 } else if (identifier is PrefixedIdentifier) { |
| 36 int prefix = visitor.serializeReference(null, identifier.prefix.name); | 48 int prefix = visitor.serializeReference(null, identifier.prefix.name); |
| 37 b.reference = | 49 b.reference = |
| 38 visitor.serializeReference(prefix, identifier.identifier.name); | 50 visitor.serializeReference(prefix, identifier.identifier.name); |
| 39 } else { | 51 } else { |
| 40 throw new StateError( | 52 throw new StateError( |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 /** | 861 /** |
| 850 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. | 862 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. |
| 851 */ | 863 */ |
| 852 class _TypeParameterScope extends _Scope { | 864 class _TypeParameterScope extends _Scope { |
| 853 /** | 865 /** |
| 854 * Get the number of [_ScopedTypeParameter]s defined in this | 866 * Get the number of [_ScopedTypeParameter]s defined in this |
| 855 * [_TypeParameterScope]. | 867 * [_TypeParameterScope]. |
| 856 */ | 868 */ |
| 857 int get length => _definedNames.length; | 869 int get length => _definedNames.length; |
| 858 } | 870 } |
| OLD | NEW |