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 import 'package:analyzer/dart/element/type.dart'; | 5 import 'package:analyzer/dart/element/type.dart'; |
6 import 'package:analyzer/src/dart/element/element.dart'; | 6 import 'package:analyzer/src/dart/element/element.dart'; |
7 import 'package:analyzer/src/summary/format.dart'; | 7 import 'package:analyzer/src/summary/format.dart'; |
8 import 'package:analyzer/src/summary/idl.dart'; | 8 import 'package:analyzer/src/summary/idl.dart'; |
9 import 'package:analyzer/src/summary/link.dart'; | 9 import 'package:analyzer/src/summary/link.dart'; |
10 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 void test_bundle_refers_to_bundle() { | 201 void test_bundle_refers_to_bundle() { |
202 var bundle1 = createPackageBundle(''' | 202 var bundle1 = createPackageBundle(''' |
203 var x = 0; | 203 var x = 0; |
204 ''', path: '/a.dart'); | 204 ''', path: '/a.dart'); |
205 addBundle('/a.ds', bundle1); | 205 addBundle('/a.ds', bundle1); |
206 var bundle2 = createPackageBundle(''' | 206 var bundle2 = createPackageBundle(''' |
207 import "a.dart"; | 207 import "a.dart"; |
208 var y = x; | 208 var y = x; |
209 ''', path: '/b.dart'); | 209 ''', path: '/b.dart'); |
210 expect(bundle2.dependencies, hasLength(1)); | |
211 expect(bundle2.dependencies[0].summaryPath, '/a.ds'); | |
212 expect(bundle2.dependencies[0].apiSignature, bundle1.apiSignature); | |
213 addBundle('/a.ds', bundle1); | 210 addBundle('/a.ds', bundle1); |
214 addBundle('/b.ds', bundle2); | 211 addBundle('/b.ds', bundle2); |
215 createLinker(''' | 212 createLinker(''' |
216 import "b.dart"; | 213 import "b.dart"; |
217 var z = y; | 214 var z = y; |
218 '''); | 215 '''); |
219 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri); | 216 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri); |
220 expect(_getVariable(library.getContainedName('z')).inferredType.toString(), | 217 expect(_getVariable(library.getContainedName('z')).inferredType.toString(), |
221 'int'); | 218 'int'); |
222 } | 219 } |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 */ | 960 */ |
964 EntityRef _lookupInferredType(LinkedUnit unit, int slot) { | 961 EntityRef _lookupInferredType(LinkedUnit unit, int slot) { |
965 for (EntityRef ref in unit.types) { | 962 for (EntityRef ref in unit.types) { |
966 if (ref.slot == slot) { | 963 if (ref.slot == slot) { |
967 return ref; | 964 return ref; |
968 } | 965 } |
969 } | 966 } |
970 return null; | 967 return null; |
971 } | 968 } |
972 } | 969 } |
OLD | NEW |