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

Side by Side Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1052053002: Resolve type hierarchies for all units of the library's import closure. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
OLDNEW
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.task.dart_test; 5 library test.src.task.dart_test;
6 6
7 import 'package:analyzer/file_system/file_system.dart'; 7 import 'package:analyzer/file_system/file_system.dart';
8 import 'package:analyzer/file_system/memory_file_system.dart'; 8 import 'package:analyzer/file_system/memory_file_system.dart';
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 LibraryElement library = outputs[LIBRARY_ELEMENT5]; 1319 LibraryElement library = outputs[LIBRARY_ELEMENT5];
1320 { 1320 {
1321 ClassElement classB = library.getType('B'); 1321 ClassElement classB = library.getType('B');
1322 expect(classB.supertype.displayName, 'A'); 1322 expect(classB.supertype.displayName, 'A');
1323 } 1323 }
1324 { 1324 {
1325 ClassElement classC = library.getType('C'); 1325 ClassElement classC = library.getType('C');
1326 expect(classC.supertype.displayName, 'A'); 1326 expect(classC.supertype.displayName, 'A');
1327 } 1327 }
1328 } 1328 }
1329
1330 test_perform_deep() {
1331 Source sourceA = _newSource('/a.dart', '''
1332 library a;
1333 import 'b.dart';
1334 class A extends B {}
1335 ''');
1336 _newSource('/b.dart', '''
1337 library b;
1338 import 'c.dart';
1339 part 'b2.dart';
1340 class B extends B2 {}
1341 ''');
1342 _newSource('/b2.dart', '''
1343 part of b;
1344 class B2 extends C {}
1345 ''');
1346 _newSource('/c.dart', '''
1347 library c;
1348 class C {}
1349 ''');
1350 _computeResult(sourceA, LIBRARY_ELEMENT5);
1351 expect(task, new isInstanceOf<ResolveLibraryTypeNamesTask>());
1352 // validate
1353 LibraryElement library = outputs[LIBRARY_ELEMENT5];
1354 {
1355 ClassElement clazz = library.getType('A');
1356 expect(clazz.displayName, 'A');
1357 clazz = clazz.supertype.element;
1358 expect(clazz.displayName, 'B');
1359 clazz = clazz.supertype.element;
1360 expect(clazz.displayName, 'B2');
1361 clazz = clazz.supertype.element;
1362 expect(clazz.displayName, 'C');
1363 clazz = clazz.supertype.element;
1364 expect(clazz.displayName, 'Object');
1365 expect(clazz.supertype, isNull);
1366 }
1367 }
1329 } 1368 }
1330 1369
1331 @reflectiveTest 1370 @reflectiveTest
1332 class ResolveReferencesTaskTest extends _AbstractDartTaskTest { 1371 class ResolveReferencesTaskTest extends _AbstractDartTaskTest {
1333 test_perform() { 1372 test_perform() {
1334 Source source = _newSource('/test.dart', ''' 1373 Source source = _newSource('/test.dart', '''
1335 class A { 1374 class A {
1336 m() {} 1375 m() {}
1337 } 1376 }
1338 main(A a) { 1377 main(A a) {
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 return entryMap.putIfAbsent(target, () => new CacheEntry()); 1723 return entryMap.putIfAbsent(target, () => new CacheEntry());
1685 } 1724 }
1686 1725
1687 TimestampedData<String> getContents(Source source) => source.contents; 1726 TimestampedData<String> getContents(Source source) => source.contents;
1688 1727
1689 noSuchMethod(Invocation invocation) { 1728 noSuchMethod(Invocation invocation) {
1690 print('noSuchMethod: ${invocation.memberName}'); 1729 print('noSuchMethod: ${invocation.memberName}');
1691 return super.noSuchMethod(invocation); 1730 return super.noSuchMethod(invocation);
1692 } 1731 }
1693 } 1732 }
OLDNEW
« pkg/analyzer/lib/task/model.dart ('K') | « pkg/analyzer/lib/task/model.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698