| 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 dart2js.serialization.elements; | 5 library dart2js.serialization.elements; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../constants/constructors.dart'; | 8 import '../constants/constructors.dart'; |
| 9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 } | 433 } |
| 434 | 434 |
| 435 void serialize(FunctionElement element, ObjectEncoder encoder, | 435 void serialize(FunctionElement element, ObjectEncoder encoder, |
| 436 SerializedElementKind kind) { | 436 SerializedElementKind kind) { |
| 437 encoder.setString(Key.NAME, element.name); | 437 encoder.setString(Key.NAME, element.name); |
| 438 SerializerUtil.serializePosition(element, encoder); | 438 SerializerUtil.serializePosition(element, encoder); |
| 439 SerializerUtil.serializeParameters(element, encoder); | 439 SerializerUtil.serializeParameters(element, encoder); |
| 440 encoder.setType(Key.TYPE, element.type); | 440 encoder.setType(Key.TYPE, element.type); |
| 441 if (element.isFunction) { | 441 if (element.isFunction) { |
| 442 encoder.setBool(Key.IS_OPERATOR, element.isOperator); | 442 encoder.setBool(Key.IS_OPERATOR, element.isOperator); |
| 443 encoder.setEnum(Key.ASYNC_MARKER, element.asyncMarker); |
| 443 } | 444 } |
| 444 SerializerUtil.serializeParentRelation(element, encoder); | 445 SerializerUtil.serializeParentRelation(element, encoder); |
| 445 encoder.setBool(Key.IS_EXTERNAL, element.isExternal); | 446 encoder.setBool(Key.IS_EXTERNAL, element.isExternal); |
| 446 if (element.isLocal) { | 447 if (element.isLocal) { |
| 447 LocalFunctionElement localFunction = element; | 448 LocalFunctionElement localFunction = element; |
| 448 encoder.setElement( | 449 encoder.setElement( |
| 449 Key.EXECUTABLE_CONTEXT, localFunction.executableContext); | 450 Key.EXECUTABLE_CONTEXT, localFunction.executableContext); |
| 450 } | 451 } |
| 451 } | 452 } |
| 452 } | 453 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 } | 507 } |
| 507 | 508 |
| 508 void serialize(ParameterElement element, ObjectEncoder encoder, | 509 void serialize(ParameterElement element, ObjectEncoder encoder, |
| 509 SerializedElementKind kind) { | 510 SerializedElementKind kind) { |
| 510 encoder.setElement(Key.FUNCTION, element.functionDeclaration); | 511 encoder.setElement(Key.FUNCTION, element.functionDeclaration); |
| 511 encoder.setString(Key.NAME, element.name); | 512 encoder.setString(Key.NAME, element.name); |
| 512 SerializerUtil.serializePosition(element, encoder); | 513 SerializerUtil.serializePosition(element, encoder); |
| 513 encoder.setType(Key.TYPE, element.type); | 514 encoder.setType(Key.TYPE, element.type); |
| 514 encoder.setBool(Key.IS_OPTIONAL, element.isOptional); | 515 encoder.setBool(Key.IS_OPTIONAL, element.isOptional); |
| 515 encoder.setBool(Key.IS_NAMED, element.isNamed); | 516 encoder.setBool(Key.IS_NAMED, element.isNamed); |
| 517 encoder.setBool(Key.IS_FINAL, element.isFinal); |
| 516 if (element.isOptional) { | 518 if (element.isOptional) { |
| 517 encoder.setConstant(Key.CONSTANT, element.constant); | 519 encoder.setConstant(Key.CONSTANT, element.constant); |
| 518 } | 520 } |
| 519 if (element.isInitializingFormal) { | 521 if (element.isInitializingFormal) { |
| 520 InitializingFormalElement initializingFormal = element; | 522 InitializingFormalElement initializingFormal = element; |
| 521 encoder.setElement(Key.FIELD, initializingFormal.fieldElement); | 523 encoder.setElement(Key.FIELD, initializingFormal.fieldElement); |
| 522 } | 524 } |
| 523 } | 525 } |
| 524 } | 526 } |
| 525 | 527 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 return new TopLevelSetterElementZ(decoder); | 669 return new TopLevelSetterElementZ(decoder); |
| 668 case SerializedElementKind.STATIC_SETTER: | 670 case SerializedElementKind.STATIC_SETTER: |
| 669 return new StaticSetterElementZ(decoder); | 671 return new StaticSetterElementZ(decoder); |
| 670 case SerializedElementKind.INSTANCE_SETTER: | 672 case SerializedElementKind.INSTANCE_SETTER: |
| 671 return new InstanceSetterElementZ(decoder); | 673 return new InstanceSetterElementZ(decoder); |
| 672 case SerializedElementKind.TYPEDEF: | 674 case SerializedElementKind.TYPEDEF: |
| 673 return new TypedefElementZ(decoder); | 675 return new TypedefElementZ(decoder); |
| 674 case SerializedElementKind.TYPEVARIABLE: | 676 case SerializedElementKind.TYPEVARIABLE: |
| 675 return new TypeVariableElementZ(decoder); | 677 return new TypeVariableElementZ(decoder); |
| 676 case SerializedElementKind.PARAMETER: | 678 case SerializedElementKind.PARAMETER: |
| 677 return new ParameterElementZ(decoder); | 679 return new LocalParameterElementZ(decoder); |
| 678 case SerializedElementKind.INITIALIZING_FORMAL: | 680 case SerializedElementKind.INITIALIZING_FORMAL: |
| 679 return new InitializingFormalElementZ(decoder); | 681 return new InitializingFormalElementZ(decoder); |
| 680 case SerializedElementKind.IMPORT: | 682 case SerializedElementKind.IMPORT: |
| 681 return new ImportElementZ(decoder); | 683 return new ImportElementZ(decoder); |
| 682 case SerializedElementKind.EXPORT: | 684 case SerializedElementKind.EXPORT: |
| 683 return new ExportElementZ(decoder); | 685 return new ExportElementZ(decoder); |
| 684 case SerializedElementKind.PREFIX: | 686 case SerializedElementKind.PREFIX: |
| 685 return new PrefixElementZ(decoder); | 687 return new PrefixElementZ(decoder); |
| 686 case SerializedElementKind.LOCAL_VARIABLE: | 688 case SerializedElementKind.LOCAL_VARIABLE: |
| 687 return new LocalVariableElementZ(decoder); | 689 return new LocalVariableElementZ(decoder); |
| 688 case SerializedElementKind.EXTERNAL_LIBRARY: | 690 case SerializedElementKind.EXTERNAL_LIBRARY: |
| 689 case SerializedElementKind.EXTERNAL_LIBRARY_MEMBER: | 691 case SerializedElementKind.EXTERNAL_LIBRARY_MEMBER: |
| 690 case SerializedElementKind.EXTERNAL_STATIC_MEMBER: | 692 case SerializedElementKind.EXTERNAL_STATIC_MEMBER: |
| 691 case SerializedElementKind.EXTERNAL_CONSTRUCTOR: | 693 case SerializedElementKind.EXTERNAL_CONSTRUCTOR: |
| 692 break; | 694 break; |
| 693 } | 695 } |
| 694 throw new UnsupportedError("Unexpected element kind '${elementKind}."); | 696 throw new UnsupportedError("Unexpected element kind '${elementKind}."); |
| 695 } | 697 } |
| 696 } | 698 } |
| OLD | NEW |