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

Unified Diff: tests/compiler/dart2js/mirrors/mirrors_test_helper.dart

Issue 108753003: Test source mirrors with lib/mirrors test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comment. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: tests/compiler/dart2js/mirrors/mirrors_test_helper.dart
diff --git a/tests/compiler/dart2js/mirrors/mirrors_test_helper.dart b/tests/compiler/dart2js/mirrors/mirrors_test_helper.dart
new file mode 100644
index 0000000000000000000000000000000000000000..af4530526c4cf3b144548ea706babba80f294d70
--- /dev/null
+++ b/tests/compiler/dart2js/mirrors/mirrors_test_helper.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:io';
+import 'dart:async';
+import 'dart:mirrors';
+
+import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/source_mirrors.dart' as source_mirrors;
+import '../../../../sdk/lib/_internal/compiler/implementation/mirrors/analyze.dart' as source_mirrors;
+import '../../../../sdk/lib/_internal/compiler/implementation/source_file_provider.dart';
+
+TypeMirror createInstantiation(source_mirrors.TypeMirror type,
+ List<TypeMirror> typeArguments) {
+ return type.createInstantiation(typeArguments);
+}
+
+Future<MirrorSystem> analyze(String test) {
+ Uri repository = Platform.script.resolve('../../../../');
+ Uri testUri = repository.resolve('tests/lib/mirrors/$test');
+ Uri libraryRoot = repository.resolve('sdk/');
+ Uri packageRoot = Uri.base.resolve('${Platform.packageRoot}/');
+ var provider = new CompilerSourceFileProvider();
+ var handler = new FormattingDiagnosticHandler(provider);
+ return source_mirrors.analyze(
+ [testUri],
+ libraryRoot,
+ packageRoot,
+ provider,
+ handler);
+}

Powered by Google App Engine
This is Rietveld 408576698