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

Side by Side Diff: pkg/analyzer/test/src/dart/analysis/file_state_test.dart

Issue 2670843004: Record defined top-level/class-mebber names with unlinked bundles. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « pkg/analyzer/test/src/dart/analysis/defined_names_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 'dart:convert'; 5 import 'dart:convert';
6 import 'dart:typed_data'; 6 import 'dart:typed_data';
7 7
8 import 'package:analyzer/file_system/file_system.dart'; 8 import 'package:analyzer/file_system/file_system.dart';
9 import 'package:analyzer/file_system/memory_file_system.dart'; 9 import 'package:analyzer/file_system/memory_file_system.dart';
10 import 'package:analyzer/source/package_map_resolver.dart'; 10 import 'package:analyzer/source/package_map_resolver.dart';
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 'bbb': [provider.getFolder(_p('/bbb/lib'))], 55 'bbb': [provider.getFolder(_p('/bbb/lib'))],
56 }), 56 }),
57 new ResourceUriResolver(provider) 57 new ResourceUriResolver(provider)
58 ], null, provider); 58 ], null, provider);
59 AnalysisOptions analysisOptions = new AnalysisOptionsImpl() 59 AnalysisOptions analysisOptions = new AnalysisOptionsImpl()
60 ..strongMode = true; 60 ..strongMode = true;
61 fileSystemState = new FileSystemState(logger, byteStore, contentOverlay, 61 fileSystemState = new FileSystemState(logger, byteStore, contentOverlay,
62 provider, sourceFactory, analysisOptions, new Uint32List(0)); 62 provider, sourceFactory, analysisOptions, new Uint32List(0));
63 } 63 }
64 64
65 test_definedClassMemberNames() {
66 String path = _p('/aaa/lib/a.dart');
67 provider.newFile(
68 path,
69 r'''
70 class A {
71 int a, b;
72 A();
73 A.c();
74 d() {}
75 get e => null;
76 set f(_) {}
77 }
78 class B {
79 g() {}
80 }
81 ''');
82 FileState file = fileSystemState.getFileForPath(path);
83 expect(file.definedClassMemberNames,
84 unorderedEquals(['a', 'b', 'd', 'e', 'f', 'g']));
85 }
86
87 test_definedTopLevelNames() {
88 String path = _p('/aaa/lib/a.dart');
89 provider.newFile(
90 path,
91 r'''
92 class A {}
93 class B = Object with A;
94 typedef C {}
95 D() {}
96 get E => null;
97 set F(_) {}
98 var G, H;
99 ''');
100 FileState file = fileSystemState.getFileForPath(path);
101 expect(file.definedTopLevelNames,
102 unorderedEquals(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']));
103 }
104
65 test_exportedTopLevelDeclarations_export() { 105 test_exportedTopLevelDeclarations_export() {
66 String a = _p('/aaa/lib/a.dart'); 106 String a = _p('/aaa/lib/a.dart');
67 String b = _p('/aaa/lib/b.dart'); 107 String b = _p('/aaa/lib/b.dart');
68 provider.newFile( 108 provider.newFile(
69 a, 109 a,
70 r''' 110 r'''
71 class A {} 111 class A {}
72 '''); 112 ''');
73 provider.newFile( 113 provider.newFile(
74 b, 114 b,
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 String _p(String path) => provider.convertPath(path); 806 String _p(String path) => provider.convertPath(path);
767 807
768 static String _md5(String content) { 808 static String _md5(String content) {
769 return hex.encode(md5.convert(UTF8.encode(content)).bytes); 809 return hex.encode(md5.convert(UTF8.encode(content)).bytes);
770 } 810 }
771 } 811 }
772 812
773 class _GeneratedUriResolverMock extends TypedMock implements UriResolver {} 813 class _GeneratedUriResolverMock extends TypedMock implements UriResolver {}
774 814
775 class _SourceMock extends TypedMock implements Source {} 815 class _SourceMock extends TypedMock implements Source {}
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/dart/analysis/defined_names_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698