OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.elements; | 5 library serialization.elements; |
6 | 6 |
7 import 'package:analyzer/src/generated/element.dart'; | 7 import 'package:analyzer/src/generated/element.dart'; |
8 import 'package:analyzer/src/generated/resolver.dart'; | 8 import 'package:analyzer/src/generated/resolver.dart'; |
9 import 'package:analyzer/src/generated/utilities_dart.dart'; | 9 import 'package:analyzer/src/generated/utilities_dart.dart'; |
10 import 'package:analyzer/src/summary/builder.dart'; | 10 import 'package:analyzer/src/summary/builder.dart'; |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 } else if (executableElement is ConstructorElement) { | 387 } else if (executableElement is ConstructorElement) { |
388 b.kind = UnlinkedExecutableKind.constructor; | 388 b.kind = UnlinkedExecutableKind.constructor; |
389 b.isConst = executableElement.isConst; | 389 b.isConst = executableElement.isConst; |
390 b.isFactory = executableElement.isFactory; | 390 b.isFactory = executableElement.isFactory; |
391 } else { | 391 } else { |
392 b.kind = UnlinkedExecutableKind.functionOrMethod; | 392 b.kind = UnlinkedExecutableKind.functionOrMethod; |
393 } | 393 } |
394 b.isAbstract = executableElement.isAbstract; | 394 b.isAbstract = executableElement.isAbstract; |
395 b.isStatic = executableElement.isStatic && | 395 b.isStatic = executableElement.isStatic && |
396 executableElement.enclosingElement is ClassElement; | 396 executableElement.enclosingElement is ClassElement; |
| 397 b.hasImplicitReturnType = executableElement.hasImplicitReturnType; |
397 return b; | 398 return b; |
398 } | 399 } |
399 | 400 |
400 /** | 401 /** |
401 * Serialize the given [exportElement] into an [UnlinkedExport]. | 402 * Serialize the given [exportElement] into an [UnlinkedExport]. |
402 */ | 403 */ |
403 UnlinkedExportBuilder serializeExport(ExportElement exportElement) { | 404 UnlinkedExportBuilder serializeExport(ExportElement exportElement) { |
404 UnlinkedExportBuilder b = new UnlinkedExportBuilder(ctx); | 405 UnlinkedExportBuilder b = new UnlinkedExportBuilder(ctx); |
405 b.uri = exportElement.uri; | 406 b.uri = exportElement.uri; |
406 b.combinators = exportElement.combinators.map(serializeCombinator).toList(); | 407 b.combinators = exportElement.combinators.map(serializeCombinator).toList(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 b.isInitializingFormal = parameter.isInitializingFormal; | 490 b.isInitializingFormal = parameter.isInitializingFormal; |
490 DartType type = parameter.type; | 491 DartType type = parameter.type; |
491 if (type is FunctionType) { | 492 if (type is FunctionType) { |
492 b.isFunctionTyped = true; | 493 b.isFunctionTyped = true; |
493 if (!type.returnType.isVoid) { | 494 if (!type.returnType.isVoid) { |
494 b.type = serializeTypeRef(type.returnType, parameter); | 495 b.type = serializeTypeRef(type.returnType, parameter); |
495 } | 496 } |
496 b.parameters = type.parameters.map(serializeParam).toList(); | 497 b.parameters = type.parameters.map(serializeParam).toList(); |
497 } else { | 498 } else { |
498 b.type = serializeTypeRef(type, parameter); | 499 b.type = serializeTypeRef(type, parameter); |
| 500 b.hasImplicitType = parameter.hasImplicitType; |
499 } | 501 } |
500 return b; | 502 return b; |
501 } | 503 } |
502 | 504 |
503 /** | 505 /** |
504 * Serialize the given [typedefElement], which exists in the unit numbered | 506 * Serialize the given [typedefElement], which exists in the unit numbered |
505 * [unitNum], creating an [UnlinkedTypedef]. | 507 * [unitNum], creating an [UnlinkedTypedef]. |
506 */ | 508 */ |
507 UnlinkedTypedefBuilder serializeTypedef( | 509 UnlinkedTypedefBuilder serializeTypedef( |
508 FunctionTypeAliasElement typedefElement, int unitNum) { | 510 FunctionTypeAliasElement typedefElement, int unitNum) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 if (variable.enclosingElement is ClassElement) { | 620 if (variable.enclosingElement is ClassElement) { |
619 assert(unitNum == 0); | 621 assert(unitNum == 0); |
620 } | 622 } |
621 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx); | 623 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx); |
622 b.name = variable.name; | 624 b.name = variable.name; |
623 b.unit = unitNum; | 625 b.unit = unitNum; |
624 b.type = serializeTypeRef(variable.type, variable); | 626 b.type = serializeTypeRef(variable.type, variable); |
625 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; | 627 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; |
626 b.isFinal = variable.isFinal; | 628 b.isFinal = variable.isFinal; |
627 b.isConst = variable.isConst; | 629 b.isConst = variable.isConst; |
| 630 b.hasImplicitType = variable.hasImplicitType; |
628 return b; | 631 return b; |
629 } | 632 } |
630 } | 633 } |
OLD | NEW |