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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 })) | 1037 })) |
1038 .toList(); | 1038 .toList(); |
1039 } | 1039 } |
1040 executables.add(b); | 1040 executables.add(b); |
1041 } | 1041 } |
1042 | 1042 |
1043 @override | 1043 @override |
1044 UnlinkedParamBuilder visitDefaultFormalParameter( | 1044 UnlinkedParamBuilder visitDefaultFormalParameter( |
1045 DefaultFormalParameter node) { | 1045 DefaultFormalParameter node) { |
1046 UnlinkedParamBuilder b = node.parameter.accept(this); | 1046 UnlinkedParamBuilder b = node.parameter.accept(this); |
| 1047 b.initializer = serializeInitializerFunction(node.defaultValue); |
1047 if (node.defaultValue != null) { | 1048 if (node.defaultValue != null) { |
1048 // Closures can't appear inside default values, so we don't need a | 1049 // Closures can't appear inside default values, so we don't need a |
1049 // localClosureIndexMap. | 1050 // localClosureIndexMap. |
1050 Map<int, int> localClosureIndexMap = null; | 1051 Map<int, int> localClosureIndexMap = null; |
1051 b.defaultValue = | 1052 b.initializer?.bodyExpr = |
1052 serializeConstExpr(localClosureIndexMap, node.defaultValue); | 1053 serializeConstExpr(localClosureIndexMap, node.defaultValue); |
1053 b.defaultValueCode = node.defaultValue.toSource(); | 1054 b.defaultValueCode = node.defaultValue.toSource(); |
1054 } | 1055 } |
1055 b.initializer = serializeInitializerFunction(node.defaultValue); | |
1056 b.codeRange = serializeCodeRange(node); | 1056 b.codeRange = serializeCodeRange(node); |
1057 return b; | 1057 return b; |
1058 } | 1058 } |
1059 | 1059 |
1060 @override | 1060 @override |
1061 void visitEnumDeclaration(EnumDeclaration node) { | 1061 void visitEnumDeclaration(EnumDeclaration node) { |
1062 UnlinkedEnumBuilder b = new UnlinkedEnumBuilder(); | 1062 UnlinkedEnumBuilder b = new UnlinkedEnumBuilder(); |
1063 b.name = node.name.name; | 1063 b.name = node.name.name; |
1064 b.nameOffset = node.name.offset; | 1064 b.nameOffset = node.name.offset; |
1065 b.values = node.constants | 1065 b.values = node.constants |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 /** | 1343 /** |
1344 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. | 1344 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. |
1345 */ | 1345 */ |
1346 class _TypeParameterScope extends _Scope { | 1346 class _TypeParameterScope extends _Scope { |
1347 /** | 1347 /** |
1348 * Get the number of [_ScopedTypeParameter]s defined in this | 1348 * Get the number of [_ScopedTypeParameter]s defined in this |
1349 * [_TypeParameterScope]. | 1349 * [_TypeParameterScope]. |
1350 */ | 1350 */ |
1351 int get length => _definedNames.length; | 1351 int get length => _definedNames.length; |
1352 } | 1352 } |
OLD | NEW |