| 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; | 1111 b.isExternal = node.externalKeyword != null || node.body is NativeFunctionBo
dy; |
| 1112 b.documentationComment = serializeDocumentation(node.documentationComment); | 1112 b.documentationComment = serializeDocumentation(node.documentationComment); |
| 1113 b.annotations = serializeAnnotations(node.metadata); | 1113 b.annotations = serializeAnnotations(node.metadata); |
| 1114 b.codeRange = serializeCodeRange(node); | 1114 b.codeRange = serializeCodeRange(node); |
| 1115 Map<int, int> localClosureIndexMap = serializeFunctionBody( | 1115 Map<int, int> localClosureIndexMap = serializeFunctionBody( |
| 1116 b, node.initializers, node.body, node.constKeyword != null, false); | 1116 b, node.initializers, node.body, node.constKeyword != null, false); |
| 1117 if (node.constKeyword != null) { | 1117 if (node.constKeyword != null) { |
| 1118 Set<String> constructorParameterNames = | 1118 Set<String> constructorParameterNames = |
| 1119 node.parameters.parameters.map((p) => p.identifier.name).toSet(); | 1119 node.parameters.parameters.map((p) => p.identifier.name).toSet(); |
| 1120 b.constantInitializers = node.initializers | 1120 b.constantInitializers = node.initializers |
| 1121 .map((ConstructorInitializer initializer) => | 1121 .map((ConstructorInitializer initializer) => |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 node.isGetter, | 1223 node.isGetter, |
| 1224 node.isSetter, | 1224 node.isSetter, |
| 1225 node.returnType, | 1225 node.returnType, |
| 1226 node.functionExpression.parameters, | 1226 node.functionExpression.parameters, |
| 1227 node.functionExpression.body, | 1227 node.functionExpression.body, |
| 1228 true, | 1228 true, |
| 1229 false, | 1229 false, |
| 1230 node.documentationComment, | 1230 node.documentationComment, |
| 1231 node.metadata, | 1231 node.metadata, |
| 1232 node.functionExpression.typeParameters, | 1232 node.functionExpression.typeParameters, |
| 1233 node.externalKeyword != null, | 1233 node.externalKeyword != null || node.functionExpression.body is NativeFu
nctionBody, |
| 1234 false, | 1234 false, |
| 1235 node.parent is FunctionDeclarationStatement)); | 1235 node.parent is FunctionDeclarationStatement)); |
| 1236 } | 1236 } |
| 1237 | 1237 |
| 1238 @override | 1238 @override |
| 1239 void visitFunctionExpression(FunctionExpression node) { | 1239 void visitFunctionExpression(FunctionExpression node) { |
| 1240 if (node.parent is! FunctionDeclaration) { | 1240 if (node.parent is! FunctionDeclaration) { |
| 1241 if (_localClosureIndexMap != null) { | 1241 if (_localClosureIndexMap != null) { |
| 1242 _localClosureIndexMap[node.offset] = executables.length; | 1242 _localClosureIndexMap[node.offset] = executables.length; |
| 1243 } | 1243 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1350 node.isGetter, | 1350 node.isGetter, |
| 1351 node.isSetter, | 1351 node.isSetter, |
| 1352 node.returnType, | 1352 node.returnType, |
| 1353 node.parameters, | 1353 node.parameters, |
| 1354 node.body, | 1354 node.body, |
| 1355 false, | 1355 false, |
| 1356 node.isStatic, | 1356 node.isStatic, |
| 1357 node.documentationComment, | 1357 node.documentationComment, |
| 1358 node.metadata, | 1358 node.metadata, |
| 1359 node.typeParameters, | 1359 node.typeParameters, |
| 1360 node.externalKeyword != null, | 1360 node.externalKeyword != null || node.body is NativeFunctionBody, |
| 1361 false, | 1361 false, |
| 1362 false)); | 1362 false)); |
| 1363 } | 1363 } |
| 1364 | 1364 |
| 1365 @override | 1365 @override |
| 1366 void visitPartDirective(PartDirective node) { | 1366 void visitPartDirective(PartDirective node) { |
| 1367 parts.add(new UnlinkedPartBuilder( | 1367 parts.add(new UnlinkedPartBuilder( |
| 1368 uriOffset: node.uri.offset, | 1368 uriOffset: node.uri.offset, |
| 1369 uriEnd: node.uri.end, | 1369 uriEnd: node.uri.end, |
| 1370 annotations: serializeAnnotations(node.metadata))); | 1370 annotations: serializeAnnotations(node.metadata))); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 /** | 1421 /** |
| 1422 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. | 1422 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. |
| 1423 */ | 1423 */ |
| 1424 class _TypeParameterScope extends _Scope { | 1424 class _TypeParameterScope extends _Scope { |
| 1425 /** | 1425 /** |
| 1426 * Get the number of [_ScopedTypeParameter]s defined in this | 1426 * Get the number of [_ScopedTypeParameter]s defined in this |
| 1427 * [_TypeParameterScope]. | 1427 * [_TypeParameterScope]. |
| 1428 */ | 1428 */ |
| 1429 int get length => _definedNames.length; | 1429 int get length => _definedNames.length; |
| 1430 } | 1430 } |
| OLD | NEW |