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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 /** | 324 /** |
325 * If the library has a library directive, the documentation comment for it | 325 * If the library has a library directive, the documentation comment for it |
326 * (if any). Otherwise `null`. | 326 * (if any). Otherwise `null`. |
327 */ | 327 */ |
328 UnlinkedDocumentationCommentBuilder libraryDocumentationComment; | 328 UnlinkedDocumentationCommentBuilder libraryDocumentationComment; |
329 | 329 |
330 /** | 330 /** |
331 * If the library has a library directive, the annotations for it (if any). | 331 * If the library has a library directive, the annotations for it (if any). |
332 * Otherwise `null`. | 332 * Otherwise `null`. |
333 */ | 333 */ |
334 List<UnlinkedConst> libraryAnnotations = const <UnlinkedConstBuilder>[]; | 334 List<UnlinkedExpr> libraryAnnotations = const <UnlinkedExprBuilder>[]; |
335 | 335 |
336 /** | 336 /** |
337 * The number of slot ids which have been assigned to this compilation unit. | 337 * The number of slot ids which have been assigned to this compilation unit. |
338 */ | 338 */ |
339 int numSlots = 0; | 339 int numSlots = 0; |
340 | 340 |
341 /** | 341 /** |
342 * The [Block] that is being visited now, or `null` for non-local contexts. | 342 * The [Block] that is being visited now, or `null` for non-local contexts. |
343 */ | 343 */ |
344 Block enclosingBlock = null; | 344 Block enclosingBlock = null; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 400 } |
401 } | 401 } |
402 } | 402 } |
403 return scope; | 403 return scope; |
404 } | 404 } |
405 | 405 |
406 /** | 406 /** |
407 * Serialize the given list of [annotations]. If there are no annotations, | 407 * Serialize the given list of [annotations]. If there are no annotations, |
408 * the empty list is returned. | 408 * the empty list is returned. |
409 */ | 409 */ |
410 List<UnlinkedConstBuilder> serializeAnnotations( | 410 List<UnlinkedExprBuilder> serializeAnnotations( |
411 NodeList<Annotation> annotations) { | 411 NodeList<Annotation> annotations) { |
412 if (annotations == null || annotations.isEmpty) { | 412 if (annotations == null || annotations.isEmpty) { |
413 return const <UnlinkedConstBuilder>[]; | 413 return const <UnlinkedExprBuilder>[]; |
414 } | 414 } |
415 return annotations.map((Annotation a) { | 415 return annotations.map((Annotation a) { |
416 // Closures can't appear inside annotations, so we don't need a | 416 // Closures can't appear inside annotations, so we don't need a |
417 // localClosureIndexMap. | 417 // localClosureIndexMap. |
418 Map<int, int> localClosureIndexMap = null; | 418 Map<int, int> localClosureIndexMap = null; |
419 _ConstExprSerializer serializer = | 419 _ConstExprSerializer serializer = |
420 new _ConstExprSerializer(this, localClosureIndexMap, null); | 420 new _ConstExprSerializer(this, localClosureIndexMap, null); |
421 serializer.serializeAnnotation(a); | 421 serializer.serializeAnnotation(a); |
422 return serializer.toBuilder(); | 422 return serializer.toBuilder(); |
423 }).toList(); | 423 }).toList(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 b.parts = parts; | 539 b.parts = parts; |
540 b.references = unlinkedReferences; | 540 b.references = unlinkedReferences; |
541 b.typedefs = typedefs; | 541 b.typedefs = typedefs; |
542 b.variables = variables; | 542 b.variables = variables; |
543 b.publicNamespace = computePublicNamespace(compilationUnit); | 543 b.publicNamespace = computePublicNamespace(compilationUnit); |
544 _computeApiSignature(b); | 544 _computeApiSignature(b); |
545 return b; | 545 return b; |
546 } | 546 } |
547 | 547 |
548 /** | 548 /** |
549 * Serialize the given [expression], creating an [UnlinkedConstBuilder]. | 549 * Serialize the given [expression], creating an [UnlinkedExprBuilder]. |
550 */ | 550 */ |
551 UnlinkedConstBuilder serializeConstExpr( | 551 UnlinkedExprBuilder serializeConstExpr( |
552 Map<int, int> localClosureIndexMap, Expression expression, | 552 Map<int, int> localClosureIndexMap, Expression expression, |
553 [Set<String> parameterNames]) { | 553 [Set<String> parameterNames]) { |
554 _ConstExprSerializer serializer = | 554 _ConstExprSerializer serializer = |
555 new _ConstExprSerializer(this, localClosureIndexMap, parameterNames); | 555 new _ConstExprSerializer(this, localClosureIndexMap, parameterNames); |
556 serializer.serialize(expression); | 556 serializer.serialize(expression); |
557 return serializer.toBuilder(); | 557 return serializer.toBuilder(); |
558 } | 558 } |
559 | 559 |
560 /** | 560 /** |
561 * Serialize the given [declaredIdentifier] into [UnlinkedVariable], and | 561 * Serialize the given [declaredIdentifier] into [UnlinkedVariable], and |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 /** | 1417 /** |
1418 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. | 1418 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. |
1419 */ | 1419 */ |
1420 class _TypeParameterScope extends _Scope { | 1420 class _TypeParameterScope extends _Scope { |
1421 /** | 1421 /** |
1422 * Get the number of [_ScopedTypeParameter]s defined in this | 1422 * Get the number of [_ScopedTypeParameter]s defined in this |
1423 * [_TypeParameterScope]. | 1423 * [_TypeParameterScope]. |
1424 */ | 1424 */ |
1425 int get length => _definedNames.length; | 1425 int get length => _definedNames.length; |
1426 } | 1426 } |
OLD | NEW |