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.resolved_ast; | 5 library dart2js.serialization.resolved_ast; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/resolution.dart'; | 8 import '../common/resolution.dart'; |
9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 ObjectEncoder objectEncoder = nodeDataEncoder.createObject(); | 199 ObjectEncoder objectEncoder = nodeDataEncoder.createObject(); |
200 objectEncoder.setInt(Key.ID, id); | 200 objectEncoder.setInt(Key.ID, id); |
201 return objectEncoder; | 201 return objectEncoder; |
202 }); | 202 }); |
203 } | 203 } |
204 | 204 |
205 @override | 205 @override |
206 visitNode(Node node) { | 206 visitNode(Node node) { |
207 Element nodeElement = elements[node]; | 207 Element nodeElement = elements[node]; |
208 if (nodeElement != null) { | 208 if (nodeElement != null) { |
209 if (nodeElement.enclosingClass != null && | 209 serializeElementReference(element, Key.ELEMENT, Key.NAME, |
210 nodeElement.enclosingClass.isUnnamedMixinApplication) { | 210 getNodeDataEncoder(node), nodeElement); |
211 // TODO(johnniwinther): Handle references to members of unnamed mixin | |
212 // applications. | |
213 } else { | |
214 getNodeDataEncoder(node).setElement(Key.ELEMENT, nodeElement); | |
215 } | |
216 } | 211 } |
217 DartType type = elements.getType(node); | 212 DartType type = elements.getType(node); |
218 if (type != null) { | 213 if (type != null) { |
219 getNodeDataEncoder(node).setType(Key.TYPE, type); | 214 getNodeDataEncoder(node).setType(Key.TYPE, type); |
220 } | 215 } |
221 Selector selector = elements.getSelector(node); | 216 Selector selector = elements.getSelector(node); |
222 if (selector != null) { | 217 if (selector != null) { |
223 serializeSelector( | 218 serializeSelector( |
224 selector, getNodeDataEncoder(node).createObject(Key.SELECTOR)); | 219 selector, getNodeDataEncoder(node).createObject(Key.SELECTOR)); |
225 } | 220 } |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 } | 524 } |
530 jumpTarget.labels = linkBuilder.toLink(); | 525 jumpTarget.labels = linkBuilder.toLink(); |
531 }); | 526 }); |
532 | 527 |
533 ListDecoder dataDecoder = objectDecoder.getList(Key.DATA); | 528 ListDecoder dataDecoder = objectDecoder.getList(Key.DATA); |
534 if (dataDecoder != null) { | 529 if (dataDecoder != null) { |
535 for (int i = 0; i < dataDecoder.length; i++) { | 530 for (int i = 0; i < dataDecoder.length; i++) { |
536 ObjectDecoder objectDecoder = dataDecoder.getObject(i); | 531 ObjectDecoder objectDecoder = dataDecoder.getObject(i); |
537 int id = objectDecoder.getInt(Key.ID); | 532 int id = objectDecoder.getInt(Key.ID); |
538 Node node = nodeList[id]; | 533 Node node = nodeList[id]; |
539 Element nodeElement = | 534 Element nodeElement = deserializeElementReference( |
540 objectDecoder.getElement(Key.ELEMENT, isOptional: true); | 535 element, Key.ELEMENT, Key.NAME, objectDecoder, |
| 536 isOptional: true); |
541 if (nodeElement != null) { | 537 if (nodeElement != null) { |
542 elements[node] = nodeElement; | 538 elements[node] = nodeElement; |
543 } | 539 } |
544 DartType type = objectDecoder.getType(Key.TYPE, isOptional: true); | 540 DartType type = objectDecoder.getType(Key.TYPE, isOptional: true); |
545 if (type != null) { | 541 if (type != null) { |
546 elements.setType(node, type); | 542 elements.setType(node, type); |
547 } | 543 } |
548 ObjectDecoder selectorDecoder = | 544 ObjectDecoder selectorDecoder = |
549 objectDecoder.getObject(Key.SELECTOR, isOptional: true); | 545 objectDecoder.getObject(Key.SELECTOR, isOptional: true); |
550 if (selectorDecoder != null) { | 546 if (selectorDecoder != null) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 int targetLabelId = | 586 int targetLabelId = |
591 objectDecoder.getInt(Key.TARGET_LABEL, isOptional: true); | 587 objectDecoder.getInt(Key.TARGET_LABEL, isOptional: true); |
592 if (targetLabelId != null) { | 588 if (targetLabelId != null) { |
593 elements.registerTargetLabel(node, labelDefinitions[targetLabelId]); | 589 elements.registerTargetLabel(node, labelDefinitions[targetLabelId]); |
594 } | 590 } |
595 } | 591 } |
596 } | 592 } |
597 return new ParsedResolvedAst(element, root, elements); | 593 return new ParsedResolvedAst(element, root, elements); |
598 } | 594 } |
599 } | 595 } |
OLD | NEW |