| 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 '../elements/resolution_types.dart'; | 10 import '../elements/resolution_types.dart'; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 }); | 230 }); |
| 231 } | 231 } |
| 232 | 232 |
| 233 @override | 233 @override |
| 234 visitNode(Node node) { | 234 visitNode(Node node) { |
| 235 Element nodeElement = elements[node]; | 235 Element nodeElement = elements[node]; |
| 236 if (nodeElement != null) { | 236 if (nodeElement != null) { |
| 237 serializeElementReference(element, Key.ELEMENT, Key.NAME, | 237 serializeElementReference(element, Key.ELEMENT, Key.NAME, |
| 238 getNodeDataEncoder(node), nodeElement); | 238 getNodeDataEncoder(node), nodeElement); |
| 239 } | 239 } |
| 240 DartType type = elements.getType(node); | 240 ResolutionDartType type = elements.getType(node); |
| 241 if (type != null) { | 241 if (type != null) { |
| 242 getNodeDataEncoder(node).setType(Key.TYPE, type); | 242 getNodeDataEncoder(node).setType(Key.TYPE, type); |
| 243 } | 243 } |
| 244 Selector selector = elements.getSelector(node); | 244 Selector selector = elements.getSelector(node); |
| 245 if (selector != null) { | 245 if (selector != null) { |
| 246 serializeSelector( | 246 serializeSelector( |
| 247 selector, getNodeDataEncoder(node).createObject(Key.SELECTOR)); | 247 selector, getNodeDataEncoder(node).createObject(Key.SELECTOR)); |
| 248 } | 248 } |
| 249 ConstantExpression constant = elements.getConstant(node); | 249 ConstantExpression constant = elements.getConstant(node); |
| 250 if (constant != null) { | 250 if (constant != null) { |
| 251 getNodeDataEncoder(node).setConstant(Key.CONSTANT, constant); | 251 getNodeDataEncoder(node).setConstant(Key.CONSTANT, constant); |
| 252 } | 252 } |
| 253 DartType cachedType = elements.typesCache[node]; | 253 ResolutionDartType cachedType = elements.typesCache[node]; |
| 254 if (cachedType != null) { | 254 if (cachedType != null) { |
| 255 getNodeDataEncoder(node).setType(Key.CACHED_TYPE, cachedType); | 255 getNodeDataEncoder(node).setType(Key.CACHED_TYPE, cachedType); |
| 256 } | 256 } |
| 257 JumpTarget jumpTargetDefinition = elements.getTargetDefinition(node); | 257 JumpTarget jumpTargetDefinition = elements.getTargetDefinition(node); |
| 258 if (jumpTargetDefinition != null) { | 258 if (jumpTargetDefinition != null) { |
| 259 getNodeDataEncoder(node).setInt( | 259 getNodeDataEncoder(node).setInt( |
| 260 Key.JUMP_TARGET_DEFINITION, getJumpTargetId(jumpTargetDefinition)); | 260 Key.JUMP_TARGET_DEFINITION, getJumpTargetId(jumpTargetDefinition)); |
| 261 } | 261 } |
| 262 var nativeData = elements.getNativeData(node); | 262 var nativeData = elements.getNativeData(node); |
| 263 if (nativeData != null) { | 263 if (nativeData != null) { |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 for (int i = 0; i < dataDecoder.length; i++) { | 599 for (int i = 0; i < dataDecoder.length; i++) { |
| 600 ObjectDecoder objectDecoder = dataDecoder.getObject(i); | 600 ObjectDecoder objectDecoder = dataDecoder.getObject(i); |
| 601 int id = objectDecoder.getInt(Key.ID); | 601 int id = objectDecoder.getInt(Key.ID); |
| 602 Node node = nodeList[id]; | 602 Node node = nodeList[id]; |
| 603 Element nodeElement = deserializeElementReference( | 603 Element nodeElement = deserializeElementReference( |
| 604 element, Key.ELEMENT, Key.NAME, objectDecoder, | 604 element, Key.ELEMENT, Key.NAME, objectDecoder, |
| 605 isOptional: true); | 605 isOptional: true); |
| 606 if (nodeElement != null) { | 606 if (nodeElement != null) { |
| 607 elements[node] = nodeElement; | 607 elements[node] = nodeElement; |
| 608 } | 608 } |
| 609 DartType type = objectDecoder.getType(Key.TYPE, isOptional: true); | 609 ResolutionDartType type = |
| 610 objectDecoder.getType(Key.TYPE, isOptional: true); |
| 610 if (type != null) { | 611 if (type != null) { |
| 611 elements.setType(node, type); | 612 elements.setType(node, type); |
| 612 } | 613 } |
| 613 ObjectDecoder selectorDecoder = | 614 ObjectDecoder selectorDecoder = |
| 614 objectDecoder.getObject(Key.SELECTOR, isOptional: true); | 615 objectDecoder.getObject(Key.SELECTOR, isOptional: true); |
| 615 if (selectorDecoder != null) { | 616 if (selectorDecoder != null) { |
| 616 elements.setSelector(node, deserializeSelector(selectorDecoder)); | 617 elements.setSelector(node, deserializeSelector(selectorDecoder)); |
| 617 } | 618 } |
| 618 ConstantExpression constant = | 619 ConstantExpression constant = |
| 619 objectDecoder.getConstant(Key.CONSTANT, isOptional: true); | 620 objectDecoder.getConstant(Key.CONSTANT, isOptional: true); |
| 620 if (constant != null) { | 621 if (constant != null) { |
| 621 elements.setConstant(node, constant); | 622 elements.setConstant(node, constant); |
| 622 } | 623 } |
| 623 DartType cachedType = | 624 ResolutionDartType cachedType = |
| 624 objectDecoder.getType(Key.CACHED_TYPE, isOptional: true); | 625 objectDecoder.getType(Key.CACHED_TYPE, isOptional: true); |
| 625 if (cachedType != null) { | 626 if (cachedType != null) { |
| 626 elements.typesCache[node] = cachedType; | 627 elements.typesCache[node] = cachedType; |
| 627 } | 628 } |
| 628 ObjectDecoder sendStructureDecoder = | 629 ObjectDecoder sendStructureDecoder = |
| 629 objectDecoder.getObject(Key.SEND_STRUCTURE, isOptional: true); | 630 objectDecoder.getObject(Key.SEND_STRUCTURE, isOptional: true); |
| 630 if (sendStructureDecoder != null) { | 631 if (sendStructureDecoder != null) { |
| 631 elements.setSendStructure( | 632 elements.setSendStructure( |
| 632 node, deserializeSendStructure(sendStructureDecoder)); | 633 node, deserializeSendStructure(sendStructureDecoder)); |
| 633 } | 634 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 } | 687 } |
| 687 } | 688 } |
| 688 } | 689 } |
| 689 element.resolvedAst = | 690 element.resolvedAst = |
| 690 new ParsedResolvedAst(element, root, body, elements, uri); | 691 new ParsedResolvedAst(element, root, body, elements, uri); |
| 691 } | 692 } |
| 692 } | 693 } |
| 693 | 694 |
| 694 const Key PARAMETER_NODE = const Key('parameter.node'); | 695 const Key PARAMETER_NODE = const Key('parameter.node'); |
| 695 const Key PARAMETER_INITIALIZER = const Key('parameter.initializer'); | 696 const Key PARAMETER_INITIALIZER = const Key('parameter.initializer'); |
| OLD | NEW |