Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: pkg/analyzer/test/src/summary/linker_test.dart

Issue 2226093002: Record information about a summary's dependencies in the summary itself. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 var x = 0; 165 var x = 0;
166 ''', 166 ''',
167 path: '/a.dart'); 167 path: '/a.dart');
168 addBundle('/a.ds', bundle1); 168 addBundle('/a.ds', bundle1);
169 var bundle2 = createPackageBundle( 169 var bundle2 = createPackageBundle(
170 ''' 170 '''
171 import "a.dart"; 171 import "a.dart";
172 var y = x; 172 var y = x;
173 ''', 173 ''',
174 path: '/b.dart'); 174 path: '/b.dart');
175 expect(bundle2.dependencies, hasLength(1));
176 expect(bundle2.dependencies[0].summaryPath, '/a.ds');
177 expect(bundle2.dependencies[0].apiSignature, bundle1.apiSignature);
175 addBundle('/a.ds', bundle1); 178 addBundle('/a.ds', bundle1);
176 addBundle('/b.ds', bundle2); 179 addBundle('/b.ds', bundle2);
177 createLinker(''' 180 createLinker('''
178 import "b.dart"; 181 import "b.dart";
179 var z = y; 182 var z = y;
180 '''); 183 ''');
181 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri); 184 LibraryElementForLink library = linker.getLibrary(linkerInputs.testDartUri);
182 expect(_getVariable(library.getContainedName('z')).inferredType.toString(), 185 expect(_getVariable(library.getContainedName('z')).inferredType.toString(),
183 'int'); 186 'int');
184 } 187 }
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 PropertyAccessorElementForLink_Variable j = library.getContainedName('j'); 853 PropertyAccessorElementForLink_Variable j = library.getContainedName('j');
851 expect(j.variable.initializer, isNull); 854 expect(j.variable.initializer, isNull);
852 PropertyAccessorElementForLink_Variable v = library.getContainedName('v'); 855 PropertyAccessorElementForLink_Variable v = library.getContainedName('v');
853 expect(v.variable.initializer, isNotNull); 856 expect(v.variable.initializer, isNotNull);
854 } 857 }
855 858
856 VariableElementForLink _getVariable(ReferenceableElementForLink element) { 859 VariableElementForLink _getVariable(ReferenceableElementForLink element) {
857 return (element as PropertyAccessorElementForLink_Variable).variable; 860 return (element as PropertyAccessorElementForLink_Variable).variable;
858 } 861 }
859 } 862 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698