| 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.impact; | 5 library dart2js.serialization.impact; |
| 6 | 6 |
| 7 import '../common/resolution.dart'; | 7 import '../common/resolution.dart'; |
| 8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
| 9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 ObjectEncoder object = dynamicUses.createObject(); | 71 ObjectEncoder object = dynamicUses.createObject(); |
| 72 serializeSelector(dynamicUse.selector, object); | 72 serializeSelector(dynamicUse.selector, object); |
| 73 } | 73 } |
| 74 | 74 |
| 75 @override | 75 @override |
| 76 void visitStaticUse(StaticUse staticUse) { | 76 void visitStaticUse(StaticUse staticUse) { |
| 77 ObjectEncoder object = staticUses.createObject(); | 77 ObjectEncoder object = staticUses.createObject(); |
| 78 object.setEnum(Key.KIND, staticUse.kind); | 78 object.setEnum(Key.KIND, staticUse.kind); |
| 79 serializeElementReference( | 79 serializeElementReference( |
| 80 element, Key.ELEMENT, Key.NAME, object, staticUse.element); | 80 element, Key.ELEMENT, Key.NAME, object, staticUse.element); |
| 81 if (staticUse.type != null) { |
| 82 object.setType(Key.TYPE, staticUse.type); |
| 83 } |
| 81 } | 84 } |
| 82 | 85 |
| 83 @override | 86 @override |
| 84 void visitTypeUse(TypeUse typeUse) { | 87 void visitTypeUse(TypeUse typeUse) { |
| 85 ObjectEncoder object = typeUses.createObject(); | 88 ObjectEncoder object = typeUses.createObject(); |
| 86 object.setEnum(Key.KIND, typeUse.kind); | 89 object.setEnum(Key.KIND, typeUse.kind); |
| 87 object.setType(Key.TYPE, typeUse.type); | 90 object.setType(Key.TYPE, typeUse.type); |
| 88 } | 91 } |
| 89 } | 92 } |
| 90 | 93 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 /// Deserializes a [WorldImpact] from [objectDecoder]. | 127 /// Deserializes a [WorldImpact] from [objectDecoder]. |
| 125 static ResolutionImpact deserializeImpact(Element element, | 128 static ResolutionImpact deserializeImpact(Element element, |
| 126 ObjectDecoder objectDecoder, DeserializerPlugin nativeDataDeserializer) { | 129 ObjectDecoder objectDecoder, DeserializerPlugin nativeDataDeserializer) { |
| 127 ListDecoder staticUseDecoder = objectDecoder.getList(Key.STATIC_USES); | 130 ListDecoder staticUseDecoder = objectDecoder.getList(Key.STATIC_USES); |
| 128 List<StaticUse> staticUses = <StaticUse>[]; | 131 List<StaticUse> staticUses = <StaticUse>[]; |
| 129 for (int index = 0; index < staticUseDecoder.length; index++) { | 132 for (int index = 0; index < staticUseDecoder.length; index++) { |
| 130 ObjectDecoder object = staticUseDecoder.getObject(index); | 133 ObjectDecoder object = staticUseDecoder.getObject(index); |
| 131 StaticUseKind kind = object.getEnum(Key.KIND, StaticUseKind.values); | 134 StaticUseKind kind = object.getEnum(Key.KIND, StaticUseKind.values); |
| 132 Element usedElement = | 135 Element usedElement = |
| 133 deserializeElementReference(element, Key.ELEMENT, Key.NAME, object); | 136 deserializeElementReference(element, Key.ELEMENT, Key.NAME, object); |
| 134 staticUses.add(new StaticUse.internal(usedElement, kind)); | 137 DartType type = object.getType(Key.TYPE, isOptional: true); |
| 138 staticUses.add(new StaticUse.internal(usedElement, kind, type)); |
| 135 } | 139 } |
| 136 | 140 |
| 137 ListDecoder dynamicUseDecoder = objectDecoder.getList(Key.DYNAMIC_USES); | 141 ListDecoder dynamicUseDecoder = objectDecoder.getList(Key.DYNAMIC_USES); |
| 138 List<DynamicUse> dynamicUses = <DynamicUse>[]; | 142 List<DynamicUse> dynamicUses = <DynamicUse>[]; |
| 139 for (int index = 0; index < dynamicUseDecoder.length; index++) { | 143 for (int index = 0; index < dynamicUseDecoder.length; index++) { |
| 140 ObjectDecoder object = dynamicUseDecoder.getObject(index); | 144 ObjectDecoder object = dynamicUseDecoder.getObject(index); |
| 141 Selector selector = deserializeSelector(object); | 145 Selector selector = deserializeSelector(object); |
| 142 dynamicUses.add(new DynamicUse(selector, null)); | 146 dynamicUses.add(new DynamicUse(selector, null)); |
| 143 } | 147 } |
| 144 | 148 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 constantLiterals: constantLiterals, | 213 constantLiterals: constantLiterals, |
| 210 dynamicUses: dynamicUses, | 214 dynamicUses: dynamicUses, |
| 211 features: features, | 215 features: features, |
| 212 listLiterals: listLiterals, | 216 listLiterals: listLiterals, |
| 213 mapLiterals: mapLiterals, | 217 mapLiterals: mapLiterals, |
| 214 staticUses: staticUses, | 218 staticUses: staticUses, |
| 215 typeUses: typeUses, | 219 typeUses: typeUses, |
| 216 nativeData: nativeData); | 220 nativeData: nativeData); |
| 217 } | 221 } |
| 218 } | 222 } |
| OLD | NEW |