| 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 test.src.serialization.elements_test; | 5 library test.src.serialization.elements_test; |
| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 .toSet(); | 129 .toSet(); |
| 130 for (String requestedUri in resynthesizer.unlinkedSummariesRequested) { | 130 for (String requestedUri in resynthesizer.unlinkedSummariesRequested) { |
| 131 expect(expectedCompilationUnitUris, contains(requestedUri)); | 131 expect(expectedCompilationUnitUris, contains(requestedUri)); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 void checkPossibleLocalElements(Element resynthesized, Element original) { | 135 void checkPossibleLocalElements(Element resynthesized, Element original) { |
| 136 if (original is! LocalElement && resynthesized is! LocalElement) { | 136 if (original is! LocalElement && resynthesized is! LocalElement) { |
| 137 return; | 137 return; |
| 138 } | 138 } |
| 139 // TODO(scheglov) add support for parameters | |
| 140 if (original is ParameterElement && resynthesized is ParameterElement) { | |
| 141 return; | |
| 142 } | |
| 143 if (original is LocalElement && resynthesized is LocalElement) { | 139 if (original is LocalElement && resynthesized is LocalElement) { |
| 144 expect(resynthesized.visibleRange, original.visibleRange); | 140 expect(resynthesized.visibleRange, original.visibleRange); |
| 145 } else { | 141 } else { |
| 146 fail('Incompatible local elements ' | 142 fail('Incompatible local elements ' |
| 147 '${resynthesized.runtimeType} vs. ${original.runtimeType}'); | 143 '${resynthesized.runtimeType} vs. ${original.runtimeType}'); |
| 148 } | 144 } |
| 149 } | 145 } |
| 150 | 146 |
| 151 void checkPossibleMember( | 147 void checkPossibleMember( |
| 152 Element resynthesized, Element original, String desc) { | 148 Element resynthesized, Element original, String desc) { |
| (...skipping 3800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3953 fail('Unexpectedly tried to get unlinked summary for $uri'); | 3949 fail('Unexpectedly tried to get unlinked summary for $uri'); |
| 3954 } | 3950 } |
| 3955 return serializedUnit; | 3951 return serializedUnit; |
| 3956 } | 3952 } |
| 3957 | 3953 |
| 3958 @override | 3954 @override |
| 3959 bool hasLibrarySummary(String uri) { | 3955 bool hasLibrarySummary(String uri) { |
| 3960 return true; | 3956 return true; |
| 3961 } | 3957 } |
| 3962 } | 3958 } |
| OLD | NEW |