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

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

Issue 2571373002: Workaround for accessing part sources while resolving a library. (Closed)
Patch Set: Created 4 years 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/lib/src/dart/analysis/driver.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 library analyzer.test.driver; 5 library analyzer.test.driver;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 1156
1157 driver.addFile(c); 1157 driver.addFile(c);
1158 1158
1159 // There is no library which c.dart is a part of, so it has unresolved 1159 // There is no library which c.dart is a part of, so it has unresolved
1160 // A and B references. 1160 // A and B references.
1161 AnalysisResult result = await driver.getResult(c); 1161 AnalysisResult result = await driver.getResult(c);
1162 expect(result.errors, isNotEmpty); 1162 expect(result.errors, isNotEmpty);
1163 expect(result.unit, isNotNull); 1163 expect(result.unit, isNotNull);
1164 } 1164 }
1165 1165
1166 test_part_getResult_overlayOnly() async {
1167 var a = _p('/test/lib/a.dart');
1168 var b = _p('/test/lib/b.dart');
1169 contentOverlay[a] = r'''
1170 library a;
1171 part 'b.dart';
1172 class A {}
1173 var b = new B();
1174 ''';
1175 contentOverlay[b] = 'part of a; class B {}';
1176
1177 driver.addFile(a);
1178 driver.addFile(b);
1179
1180 AnalysisResult result = await driver.getResult(a);
1181 expect(result.errors, isEmpty);
1182 expect(_getTopLevelVarType(result.unit, 'b'), 'B');
1183 }
1184
1166 test_part_results_afterLibrary() async { 1185 test_part_results_afterLibrary() async {
1167 var a = _p('/test/lib/a.dart'); 1186 var a = _p('/test/lib/a.dart');
1168 var b = _p('/test/lib/b.dart'); 1187 var b = _p('/test/lib/b.dart');
1169 var c = _p('/test/lib/c.dart'); 1188 var c = _p('/test/lib/c.dart');
1170 provider.newFile( 1189 provider.newFile(
1171 a, 1190 a,
1172 r''' 1191 r'''
1173 library a; 1192 library a;
1174 import 'b.dart'; 1193 import 'b.dart';
1175 part 'c.dart'; 1194 part 'c.dart';
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 String _p(String path) => provider.convertPath(path); 1599 String _p(String path) => provider.convertPath(path);
1581 1600
1582 Future<Null> _waitForIdle() async { 1601 Future<Null> _waitForIdle() async {
1583 await idleStatusMonitor.signal; 1602 await idleStatusMonitor.signal;
1584 } 1603 }
1585 1604
1586 static String _md5(String content) { 1605 static String _md5(String content) {
1587 return hex.encode(md5.convert(UTF8.encode(content)).bytes); 1606 return hex.encode(md5.convert(UTF8.encode(content)).bytes);
1588 } 1607 }
1589 } 1608 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/driver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698