| 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/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/dart/element/type.dart'; | 8 import 'package:analyzer/dart/element/type.dart'; |
| 9 import 'package:analyzer/src/dart/element/type.dart'; | 9 import 'package:analyzer/src/dart/element/type.dart'; |
| 10 import 'package:analyzer/src/generated/resolver.dart'; | 10 import 'package:analyzer/src/generated/resolver.dart'; |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 return b; | 386 return b; |
| 387 } | 387 } |
| 388 | 388 |
| 389 /** | 389 /** |
| 390 * Serialize the given [executableElement], creating an [UnlinkedExecutable]. | 390 * Serialize the given [executableElement], creating an [UnlinkedExecutable]. |
| 391 */ | 391 */ |
| 392 UnlinkedExecutableBuilder serializeExecutable( | 392 UnlinkedExecutableBuilder serializeExecutable( |
| 393 ExecutableElement executableElement) { | 393 ExecutableElement executableElement) { |
| 394 UnlinkedExecutableBuilder b = new UnlinkedExecutableBuilder(ctx); | 394 UnlinkedExecutableBuilder b = new UnlinkedExecutableBuilder(ctx); |
| 395 b.name = executableElement.name; | 395 b.name = executableElement.name; |
| 396 if (!executableElement.type.returnType.isVoid) { | 396 if (executableElement is! ConstructorElement && |
| 397 !executableElement.type.returnType.isVoid) { |
| 397 b.returnType = serializeTypeRef( | 398 b.returnType = serializeTypeRef( |
| 398 executableElement.type.returnType, executableElement); | 399 executableElement.type.returnType, executableElement); |
| 399 } | 400 } |
| 400 b.typeParameters = | 401 b.typeParameters = |
| 401 executableElement.typeParameters.map(serializeTypeParam).toList(); | 402 executableElement.typeParameters.map(serializeTypeParam).toList(); |
| 402 b.parameters = | 403 b.parameters = |
| 403 executableElement.type.parameters.map(serializeParam).toList(); | 404 executableElement.type.parameters.map(serializeParam).toList(); |
| 404 if (executableElement is PropertyAccessorElement) { | 405 if (executableElement is PropertyAccessorElement) { |
| 405 if (executableElement.isGetter) { | 406 if (executableElement.isGetter) { |
| 406 b.kind = UnlinkedExecutableKind.getter; | 407 b.kind = UnlinkedExecutableKind.getter; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx); | 639 UnlinkedVariableBuilder b = new UnlinkedVariableBuilder(ctx); |
| 639 b.name = variable.name; | 640 b.name = variable.name; |
| 640 b.type = serializeTypeRef(variable.type, variable); | 641 b.type = serializeTypeRef(variable.type, variable); |
| 641 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; | 642 b.isStatic = variable.isStatic && variable.enclosingElement is ClassElement; |
| 642 b.isFinal = variable.isFinal; | 643 b.isFinal = variable.isFinal; |
| 643 b.isConst = variable.isConst; | 644 b.isConst = variable.isConst; |
| 644 b.hasImplicitType = variable.hasImplicitType; | 645 b.hasImplicitType = variable.hasImplicitType; |
| 645 return b; | 646 return b; |
| 646 } | 647 } |
| 647 } | 648 } |
| OLD | NEW |