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

Side by Side Diff: pkg/kernel/test/interpreter/suite.dart

Issue 2919003003: Reapply "Use backend targets to run Kernel transformations in Fasta" (Closed)
Patch Set: Follow dartanalyzer suggestions Created 3 years, 6 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
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 library test.kernel.closures.suite; 5 library test.kernel.closures.suite;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:io' show File; 9 import 'dart:io' show File;
10 10
(...skipping 17 matching lines...) Expand all
28 show KernelTarget; 28 show KernelTarget;
29 29
30 import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri; 30 import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri;
31 31
32 import 'package:front_end/src/fasta/errors.dart' show InputError; 32 import 'package:front_end/src/fasta/errors.dart' show InputError;
33 33
34 import 'package:front_end/src/fasta/testing/patched_sdk_location.dart'; 34 import 'package:front_end/src/fasta/testing/patched_sdk_location.dart';
35 35
36 import 'package:kernel/kernel.dart' show loadProgramFromBinary; 36 import 'package:kernel/kernel.dart' show loadProgramFromBinary;
37 37
38 import 'package:kernel/target/targets.dart' show TargetFlags;
39
38 import 'package:kernel/interpreter/interpreter.dart'; 40 import 'package:kernel/interpreter/interpreter.dart';
39 41
40 const String STRONG_MODE = " strong mode "; 42 const String STRONG_MODE = " strong mode ";
41 43
42 class InterpreterContext extends ChainContext { 44 class InterpreterContext extends ChainContext {
43 final bool strongMode; 45 final bool strongMode;
44 46
45 final TranslateUri uriTranslator; 47 final TranslateUri uriTranslator;
46 48
47 final List<Step> steps; 49 final List<Step> steps;
(...skipping 25 matching lines...) Expand all
73 75
74 class FastaCompile extends Step<TestDescription, Program, InterpreterContext> { 76 class FastaCompile extends Step<TestDescription, Program, InterpreterContext> {
75 const FastaCompile(); 77 const FastaCompile();
76 78
77 String get name => "fasta compile"; 79 String get name => "fasta compile";
78 80
79 Future<Result<Program>> run( 81 Future<Result<Program>> run(
80 TestDescription description, InterpreterContext context) async { 82 TestDescription description, InterpreterContext context) async {
81 Program platform = await context.loadPlatform(); 83 Program platform = await context.loadPlatform();
82 Ticker ticker = new Ticker(); 84 Ticker ticker = new Ticker();
83 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator, "vm"); 85 DillTarget dillTarget = new DillTarget(
86 ticker, context.uriTranslator, "vm_fasta",
87 flags: new TargetFlags(strongMode: context.strongMode));
84 platform.unbindCanonicalNames(); 88 platform.unbindCanonicalNames();
85 dillTarget.loader.appendLibraries(platform); 89 dillTarget.loader.appendLibraries(platform);
86 KernelTarget sourceTarget = new KernelTarget(PhysicalFileSystem.instance, 90 KernelTarget sourceTarget = new KernelTarget(
87 dillTarget, context.uriTranslator, context.strongMode); 91 PhysicalFileSystem.instance, dillTarget, context.uriTranslator);
88 92
89 Program p; 93 Program p;
90 try { 94 try {
91 sourceTarget.read(description.uri); 95 sourceTarget.read(description.uri);
92 await dillTarget.buildOutlines(); 96 await dillTarget.buildOutlines();
93 await sourceTarget.buildOutlines(); 97 await sourceTarget.buildOutlines();
94 p = await sourceTarget.buildProgram(); 98 p = await sourceTarget.buildProgram();
95 } on InputError catch (e, s) { 99 } on InputError catch (e, s) {
96 return fail(null, e.error, s); 100 return fail(null, e.error, s);
97 } 101 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 final Uri uri; 157 final Uri uri;
154 158
155 /// Evaluated program log. 159 /// Evaluated program log.
156 final String log; 160 final String log;
157 161
158 EvaluationLog(this.uri, this.log); 162 EvaluationLog(this.uri, this.log);
159 } 163 }
160 164
161 main(List<String> arguments) => 165 main(List<String> arguments) =>
162 runMe(arguments, InterpreterContext.create, "testing.json"); 166 runMe(arguments, InterpreterContext.create, "testing.json");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698