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 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 if (initializer is RedirectingConstructorInvocation) { | 1101 if (initializer is RedirectingConstructorInvocation) { |
1102 b.isRedirectedConstructor = true; | 1102 b.isRedirectedConstructor = true; |
1103 b.redirectedConstructorName = initializer.constructorName?.name; | 1103 b.redirectedConstructorName = initializer.constructorName?.name; |
1104 } | 1104 } |
1105 } | 1105 } |
1106 } | 1106 } |
1107 if (node.constKeyword != null) { | 1107 if (node.constKeyword != null) { |
1108 b.isConst = true; | 1108 b.isConst = true; |
1109 b.constCycleSlot = assignSlot(); | 1109 b.constCycleSlot = assignSlot(); |
1110 } | 1110 } |
1111 b.isExternal = node.externalKeyword != null || node.body is NativeFunctionBo
dy; | 1111 b.isExternal = |
| 1112 node.externalKeyword != null || node.body is NativeFunctionBody; |
1112 b.documentationComment = serializeDocumentation(node.documentationComment); | 1113 b.documentationComment = serializeDocumentation(node.documentationComment); |
1113 b.annotations = serializeAnnotations(node.metadata); | 1114 b.annotations = serializeAnnotations(node.metadata); |
1114 b.codeRange = serializeCodeRange(node); | 1115 b.codeRange = serializeCodeRange(node); |
1115 Map<int, int> localClosureIndexMap = serializeFunctionBody( | 1116 Map<int, int> localClosureIndexMap = serializeFunctionBody( |
1116 b, node.initializers, node.body, node.constKeyword != null, false); | 1117 b, node.initializers, node.body, node.constKeyword != null, false); |
1117 if (node.constKeyword != null) { | 1118 if (node.constKeyword != null) { |
1118 Set<String> constructorParameterNames = | 1119 Set<String> constructorParameterNames = |
1119 node.parameters.parameters.map((p) => p.identifier.name).toSet(); | 1120 node.parameters.parameters.map((p) => p.identifier.name).toSet(); |
1120 b.constantInitializers = node.initializers | 1121 b.constantInitializers = node.initializers |
1121 .map((ConstructorInitializer initializer) => | 1122 .map((ConstructorInitializer initializer) => |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 node.isGetter, | 1224 node.isGetter, |
1224 node.isSetter, | 1225 node.isSetter, |
1225 node.returnType, | 1226 node.returnType, |
1226 node.functionExpression.parameters, | 1227 node.functionExpression.parameters, |
1227 node.functionExpression.body, | 1228 node.functionExpression.body, |
1228 true, | 1229 true, |
1229 false, | 1230 false, |
1230 node.documentationComment, | 1231 node.documentationComment, |
1231 node.metadata, | 1232 node.metadata, |
1232 node.functionExpression.typeParameters, | 1233 node.functionExpression.typeParameters, |
1233 node.externalKeyword != null || node.functionExpression.body is NativeFu
nctionBody, | 1234 node.externalKeyword != null || |
| 1235 node.functionExpression.body is NativeFunctionBody, |
1234 false, | 1236 false, |
1235 node.parent is FunctionDeclarationStatement)); | 1237 node.parent is FunctionDeclarationStatement)); |
1236 } | 1238 } |
1237 | 1239 |
1238 @override | 1240 @override |
1239 void visitFunctionExpression(FunctionExpression node) { | 1241 void visitFunctionExpression(FunctionExpression node) { |
1240 if (node.parent is! FunctionDeclaration) { | 1242 if (node.parent is! FunctionDeclaration) { |
1241 if (_localClosureIndexMap != null) { | 1243 if (_localClosureIndexMap != null) { |
1242 _localClosureIndexMap[node.offset] = executables.length; | 1244 _localClosureIndexMap[node.offset] = executables.length; |
1243 } | 1245 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1421 /** | 1423 /** |
1422 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. | 1424 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. |
1423 */ | 1425 */ |
1424 class _TypeParameterScope extends _Scope { | 1426 class _TypeParameterScope extends _Scope { |
1425 /** | 1427 /** |
1426 * Get the number of [_ScopedTypeParameter]s defined in this | 1428 * Get the number of [_ScopedTypeParameter]s defined in this |
1427 * [_TypeParameterScope]. | 1429 * [_TypeParameterScope]. |
1428 */ | 1430 */ |
1429 int get length => _definedNames.length; | 1431 int get length => _definedNames.length; |
1430 } | 1432 } |
OLD | NEW |