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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 void visitGenericTypeAlias(GenericTypeAlias node) { | 1335 void visitGenericTypeAlias(GenericTypeAlias node) { |
1336 int oldScopesLength = scopes.length; | 1336 int oldScopesLength = scopes.length; |
1337 _TypeParameterScope typeParameterScope = new _TypeParameterScope(); | 1337 _TypeParameterScope typeParameterScope = new _TypeParameterScope(); |
1338 scopes.add(typeParameterScope); | 1338 scopes.add(typeParameterScope); |
1339 UnlinkedTypedefBuilder b = new UnlinkedTypedefBuilder(); | 1339 UnlinkedTypedefBuilder b = new UnlinkedTypedefBuilder(); |
1340 b.style = TypedefStyle.genericFunctionType; | 1340 b.style = TypedefStyle.genericFunctionType; |
1341 b.name = node.name.name; | 1341 b.name = node.name.name; |
1342 b.nameOffset = node.name.offset; | 1342 b.nameOffset = node.name.offset; |
1343 b.typeParameters = | 1343 b.typeParameters = |
1344 serializeTypeParameters(node.typeParameters, typeParameterScope); | 1344 serializeTypeParameters(node.typeParameters, typeParameterScope); |
1345 EntityRefBuilder serializedType = | 1345 GenericFunctionType functionType = node.functionType; |
1346 serializeGenericFunctionType(node.functionType); | 1346 EntityRefBuilder serializedType = functionType == null |
| 1347 ? null |
| 1348 : serializeGenericFunctionType(functionType); |
1347 if (serializedType != null) { | 1349 if (serializedType != null) { |
1348 b.returnType = serializedType; | 1350 b.returnType = serializedType; |
1349 } | 1351 } |
1350 b.documentationComment = serializeDocumentation(node.documentationComment); | 1352 b.documentationComment = serializeDocumentation(node.documentationComment); |
1351 b.annotations = serializeAnnotations(node.metadata); | 1353 b.annotations = serializeAnnotations(node.metadata); |
1352 b.codeRange = serializeCodeRange(node); | 1354 b.codeRange = serializeCodeRange(node); |
1353 typedefs.add(b); | 1355 typedefs.add(b); |
1354 scopes.removeLast(); | 1356 scopes.removeLast(); |
1355 assert(scopes.length == oldScopesLength); | 1357 assert(scopes.length == oldScopesLength); |
1356 } | 1358 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 /** | 1483 /** |
1482 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. | 1484 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. |
1483 */ | 1485 */ |
1484 class _TypeParameterScope extends _Scope { | 1486 class _TypeParameterScope extends _Scope { |
1485 /** | 1487 /** |
1486 * Get the number of [_ScopedTypeParameter]s defined in this | 1488 * Get the number of [_ScopedTypeParameter]s defined in this |
1487 * [_TypeParameterScope]. | 1489 * [_TypeParameterScope]. |
1488 */ | 1490 */ |
1489 int get length => _definedNames.length; | 1491 int get length => _definedNames.length; |
1490 } | 1492 } |
OLD | NEW |