| 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 dart2js.serialization.util; | 5 library dart2js.serialization.util; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
| 9 import '../elements/resolution_types.dart'; | 9 import '../elements/resolution_types.dart'; |
| 10 import '../diagnostics/messages.dart'; | 10 import '../diagnostics/messages.dart'; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 Key.NAMED_ARGUMENTS, selector.callStructure.namedArguments); | 45 Key.NAMED_ARGUMENTS, selector.callStructure.namedArguments); |
| 46 serializeName(selector.memberName, encoder); | 46 serializeName(selector.memberName, encoder); |
| 47 } | 47 } |
| 48 | 48 |
| 49 /// Deserialize a [Selector] from [decoder]. | 49 /// Deserialize a [Selector] from [decoder]. |
| 50 Selector deserializeSelector(ObjectDecoder decoder) { | 50 Selector deserializeSelector(ObjectDecoder decoder) { |
| 51 SelectorKind kind = decoder.getEnum(Key.KIND, SelectorKind.values); | 51 SelectorKind kind = decoder.getEnum(Key.KIND, SelectorKind.values); |
| 52 int argumentCount = decoder.getInt(Key.ARGUMENTS); | 52 int argumentCount = decoder.getInt(Key.ARGUMENTS); |
| 53 List<String> namedArguments = | 53 List<String> namedArguments = |
| 54 decoder.getStrings(Key.NAMED_ARGUMENTS, isOptional: true); | 54 decoder.getStrings(Key.NAMED_ARGUMENTS, isOptional: true); |
| 55 String name = decoder.getString(Key.NAME); | |
| 56 bool isSetter = decoder.getBool(Key.IS_SETTER); | |
| 57 LibraryElement library = decoder.getElement(Key.LIBRARY, isOptional: true); | |
| 58 return new Selector(kind, deserializeName(decoder), | 55 return new Selector(kind, deserializeName(decoder), |
| 59 new CallStructure(argumentCount, namedArguments)); | 56 new CallStructure(argumentCount, namedArguments)); |
| 60 } | 57 } |
| 61 | 58 |
| 62 /// Serialize [sendStructure] into [encoder]. | 59 /// Serialize [sendStructure] into [encoder]. |
| 63 void serializeSendStructure( | 60 void serializeSendStructure( |
| 64 SendStructure sendStructure, ObjectEncoder encoder) { | 61 SendStructure sendStructure, ObjectEncoder encoder) { |
| 65 encoder.setEnum(Key.KIND, sendStructure.kind); | 62 encoder.setEnum(Key.KIND, sendStructure.kind); |
| 66 switch (sendStructure.kind) { | 63 switch (sendStructure.kind) { |
| 67 case SendStructureKind.IF_NULL: | 64 case SendStructureKind.IF_NULL: |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 ObjectDecoder sourceSpanDecoder = | 579 ObjectDecoder sourceSpanDecoder = |
| 583 object.getObject(Key.SOURCE_SPAN, isOptional: true); | 580 object.getObject(Key.SOURCE_SPAN, isOptional: true); |
| 584 if (sourceSpanDecoder != null) { | 581 if (sourceSpanDecoder != null) { |
| 585 sourceSpan = deserializeSourceSpan(sourceSpanDecoder); | 582 sourceSpan = deserializeSourceSpan(sourceSpanDecoder); |
| 586 } | 583 } |
| 587 MessageKind messageKind = object.getEnum(Key.KIND, MessageKind.values); | 584 MessageKind messageKind = object.getEnum(Key.KIND, MessageKind.values); |
| 588 Map<String, dynamic> messageArguments = | 585 Map<String, dynamic> messageArguments = |
| 589 deserializeMessageArguments(object, Key.ARGUMENTS); | 586 deserializeMessageArguments(object, Key.ARGUMENTS); |
| 590 return new WrappedMessage(sourceSpan, messageKind, messageArguments); | 587 return new WrappedMessage(sourceSpan, messageKind, messageArguments); |
| 591 } | 588 } |
| OLD | NEW |