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

Unified Diff: pkg/kernel/test/reify/suite.dart

Issue 2697873007: Merge the work on Generic Types Reification from 'dart-lang/reify' repo (Closed)
Patch Set: Get back parameter erroneously removed by previous commit 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/kernel/test/reify/reify.status ('k') | pkg/kernel/test/reify/testing.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/test/reify/suite.dart
diff --git a/pkg/kernel/test/closures/suite.dart b/pkg/kernel/test/reify/suite.dart
similarity index 81%
copy from pkg/kernel/test/closures/suite.dart
copy to pkg/kernel/test/reify/suite.dart
index 76e2c5117b044678cc22255351b7fdca6c535425..2a8975ec83e20bbf5507a57245612e86eac024ed 100644
--- a/pkg/kernel/test/closures/suite.dart
+++ b/pkg/kernel/test/reify/suite.dart
@@ -1,8 +1,8 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2017, 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.md file.
-library test.kernel.closures.suite;
+library test.kernel.reify.suite;
import 'dart:async' show Future;
@@ -35,6 +35,9 @@ import 'package:kernel/ast.dart' show Program;
import 'package:kernel/transformations/closure_conversion.dart'
as closure_conversion;
+import 'package:kernel/transformations/generic_types_reification.dart'
+ as generic_types_reification;
+
import 'package:package_config/discovery.dart' show loadPackagesFile;
class TestContext extends ChainContext {
@@ -60,6 +63,7 @@ class TestContext extends ChainContext {
const Print(),
const SanityCheck(),
const ClosureConversion(),
+ const GenericTypesReification(),
const Print(),
const SanityCheck(),
new MatchExpectation(".expect",
@@ -126,7 +130,7 @@ Future<TestContext> createContext(
Uri packages = Uri.base.resolve(".packages");
bool strongMode = false;
- bool updateExpectations = environment["updateExpectations"] != "false";
+ bool updateExpectations = environment["updateExpectations"] == "true";
return new TestContext(sdk, vm, packages, strongMode,
createDartSdk(sdk, strongMode: strongMode), updateExpectations);
}
@@ -140,11 +144,20 @@ class Kernel extends Step<TestDescription, Program, TestContext> {
TestDescription description, TestContext testContext) async {
try {
DartLoader loader = await testContext.createLoader();
+
Target target = getTarget(
"vm", new TargetFlags(strongMode: testContext.options.strongMode));
+ // reifyTarget is used to add the GTR-specific runtime libraries
+ // when the program is being loaded
+ Target reifyTarget = getTarget(
+ "vmreify",
+ new TargetFlags(
+ strongMode: testContext.options.strongMode,
+ kernelRuntime: Platform.script.resolve('../../runtime/')));
+
String path = description.file.path;
Uri uri = Uri.base.resolve(path);
- Program program = loader.loadProgram(uri, target: target);
+ Program program = loader.loadProgram(uri, target: reifyTarget);
for (var error in loader.errors) {
return fail(program, "$error");
}
@@ -173,6 +186,21 @@ class ClosureConversion extends Step<Program, Program, TestContext> {
}
}
+class GenericTypesReification extends Step<Program, Program, TestContext> {
+ const GenericTypesReification();
+
+ String get name => "generic types reification";
+
+ Future<Result<Program>> run(Program program, TestContext testContext) async {
+ try {
+ program = generic_types_reification.transformProgram(program);
+ return pass(program);
+ } catch (e, s) {
+ return crash(e, s);
+ }
+ }
+}
+
class Run extends Step<Uri, int, TestContext> {
const Run();
@@ -182,8 +210,8 @@ class Run extends Step<Uri, int, TestContext> {
File generated = new File.fromUri(uri);
StdioProcess process;
try {
- process = await StdioProcess
- .run(context.vm.toFilePath(), [generated.path, "Hello, World!"]);
+ process =
+ await StdioProcess.run(context.vm.toFilePath(), [generated.path]);
print(process.output);
} finally {
generated.parent.delete(recursive: true);
« no previous file with comments | « pkg/kernel/test/reify/reify.status ('k') | pkg/kernel/test/reify/testing.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698