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

Unified Diff: tests/compiler/dart2js/analyze_dart2js_helpers_test.dart

Issue 2006333004: Fix analyze_dart2js_helpers_test (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/analyze_dart2js_helpers_test.dart
diff --git a/tests/compiler/dart2js/analyze_dart2js_helpers_test.dart b/tests/compiler/dart2js/analyze_dart2js_helpers_test.dart
index 7f531eb2a686fdd3edafee166f6339d737a747b6..d4d85ef24e1817cc3594e39acbcf7035bfa57f49 100644
--- a/tests/compiler/dart2js/analyze_dart2js_helpers_test.dart
+++ b/tests/compiler/dart2js/analyze_dart2js_helpers_test.dart
@@ -48,9 +48,11 @@ main(List<String> arguments) {
options: options, showDiagnostics: verbose);
FormattingDiagnosticHandler diagnostics =
new FormattingDiagnosticHandler(compiler.provider);
- HelperAnalyzer analyzer = new HelperAnalyzer(diagnostics);
Directory dir =
new Directory.fromUri(Uri.base.resolve('pkg/compiler/lib/'));
+ String helpersUriPrefix = dir.uri.resolve('src/helpers/').toString();
+ HelperAnalyzer analyzer = new HelperAnalyzer(diagnostics, helpersUriPrefix);
+ LibraryElement helperLibrary;
for (FileSystemEntity entity in dir.listSync(recursive: true)) {
if (entity is File && entity.path.endsWith('.dart')) {
Uri file = Uri.base.resolve(nativeToUriPath(entity.path));
@@ -59,6 +61,9 @@ main(List<String> arguments) {
}
LibraryElement library = await compiler.analyzeUri(file);
if (library != null) {
+ if (library.libraryName == 'dart2js.helpers') {
+ helperLibrary = library;
+ }
library.forEachLocalMember((Element element) {
if (element is ClassElement) {
element.forEachLocalMember((AstElement member) {
@@ -71,12 +76,16 @@ main(List<String> arguments) {
}
}
}
+ Expect.isNotNull(helperLibrary, 'Helper library not found');
+ Expect.isTrue(analyzer.isHelper(helperLibrary),
+ "Helper library $helperLibrary is not considered a helper.");
Expect.isTrue(analyzer.errors.isEmpty, "Errors found.");
});
}
class HelperAnalyzer extends TraversalVisitor {
final FormattingDiagnosticHandler diagnostics;
+ final String helpersUriPrefix;
List<SourceSpan> errors = <SourceSpan>[];
ResolvedAst resolvedAst;
@@ -86,7 +95,7 @@ class HelperAnalyzer extends TraversalVisitor {
AnalyzableElement get analyzedElement => resolvedAst.element;
- HelperAnalyzer(this.diagnostics) : super(null);
+ HelperAnalyzer(this.diagnostics, this.helpersUriPrefix) : super(null);
@override
void apply(Node node, [_]) {
@@ -105,7 +114,7 @@ class HelperAnalyzer extends TraversalVisitor {
bool isHelper(Element element) {
Uri uri = element.library.canonicalUri;
- return '$uri'.startsWith('package:compiler/src/helpers/');
Johnni Winther 2016/05/26 12:13:21 With the change to use `compiler.analyzeUri` some
+ return '$uri'.startsWith(helpersUriPrefix);
}
void checkAccess(Node node, MemberElement element) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698