| 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 serialization.elements; | 5 library serialization.elements; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 } else { | 1044 } else { |
| 1045 if (type is FunctionType && | 1045 if (type is FunctionType && |
| 1046 typeElement.enclosingElement is ParameterElement) { | 1046 typeElement.enclosingElement is ParameterElement) { |
| 1047 // Code cannot refer to function types implicitly defined by parameters | 1047 // Code cannot refer to function types implicitly defined by parameters |
| 1048 // directly, so if we get here, we must be serializing a linked | 1048 // directly, so if we get here, we must be serializing a linked |
| 1049 // reference from type inference. | 1049 // reference from type inference. |
| 1050 assert(buildingLinkedReferences); | 1050 assert(buildingLinkedReferences); |
| 1051 ParameterElement parameterElement = typeElement.enclosingElement; | 1051 ParameterElement parameterElement = typeElement.enclosingElement; |
| 1052 while (true) { | 1052 while (true) { |
| 1053 Element parent = parameterElement.enclosingElement; | 1053 Element parent = parameterElement.enclosingElement; |
| 1054 if (parent is ExecutableElement) { | 1054 if (parent is FunctionTypedElement) { |
| 1055 Element grandParent = parent.enclosingElement; | 1055 Element grandParent = parent.enclosingElement; |
| 1056 b.implicitFunctionTypeIndices | 1056 b.implicitFunctionTypeIndices |
| 1057 .insert(0, parent.parameters.indexOf(parameterElement)); | 1057 .insert(0, parent.parameters.indexOf(parameterElement)); |
| 1058 if (grandParent is ParameterElement) { | 1058 if (grandParent is ParameterElement) { |
| 1059 // Function-typed parameter inside a function-typed parameter. | 1059 // Function-typed parameter inside a function-typed parameter. |
| 1060 parameterElement = grandParent; | 1060 parameterElement = grandParent; |
| 1061 continue; | 1061 continue; |
| 1062 } else { | 1062 } else { |
| 1063 // Function-typed parameter inside a top level function or method. | 1063 // Function-typed parameter inside a top level function or method. |
| 1064 b.reference = _getElementReferenceId(parent); | 1064 b.reference = _getElementReferenceId(parent); |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1668 exportNames.add(new LinkedExportNameBuilder( | 1668 exportNames.add(new LinkedExportNameBuilder( |
| 1669 name: name, | 1669 name: name, |
| 1670 dependency: serializeDependency(dependentLibrary), | 1670 dependency: serializeDependency(dependentLibrary), |
| 1671 unit: unit, | 1671 unit: unit, |
| 1672 kind: kind)); | 1672 kind: kind)); |
| 1673 } | 1673 } |
| 1674 pb.exportNames = exportNames; | 1674 pb.exportNames = exportNames; |
| 1675 return pb; | 1675 return pb; |
| 1676 } | 1676 } |
| 1677 } | 1677 } |
| OLD | NEW |