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

Side by Side Diff: pkg/kernel/test/closures/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 'package:front_end/physical_file_system.dart' show PhysicalFileSystem; 9 import 'package:front_end/physical_file_system.dart' show PhysicalFileSystem;
10 10
(...skipping 21 matching lines...) Expand all
32 show KernelTarget; 32 show KernelTarget;
33 33
34 import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri; 34 import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri;
35 35
36 import 'package:front_end/src/fasta/errors.dart' show InputError; 36 import 'package:front_end/src/fasta/errors.dart' show InputError;
37 37
38 import 'package:front_end/src/fasta/testing/patched_sdk_location.dart'; 38 import 'package:front_end/src/fasta/testing/patched_sdk_location.dart';
39 39
40 import 'package:kernel/kernel.dart' show loadProgramFromBinary; 40 import 'package:kernel/kernel.dart' show loadProgramFromBinary;
41 41
42 import 'package:kernel/target/targets.dart' show TargetFlags;
43
42 const String STRONG_MODE = " strong mode "; 44 const String STRONG_MODE = " strong mode ";
43 45
44 class ClosureConversionContext extends ChainContext { 46 class ClosureConversionContext extends ChainContext {
45 final bool strongMode; 47 final bool strongMode;
46 48
47 final TranslateUri uriTranslator; 49 final TranslateUri uriTranslator;
48 50
49 final List<Step> steps; 51 final List<Step> steps;
50 52
51 ClosureConversionContext( 53 ClosureConversionContext(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 class FastaCompile 94 class FastaCompile
93 extends Step<TestDescription, Program, ClosureConversionContext> { 95 extends Step<TestDescription, Program, ClosureConversionContext> {
94 const FastaCompile(); 96 const FastaCompile();
95 97
96 String get name => "fasta compilation"; 98 String get name => "fasta compilation";
97 99
98 Future<Result<Program>> run( 100 Future<Result<Program>> run(
99 TestDescription description, ClosureConversionContext context) async { 101 TestDescription description, ClosureConversionContext context) async {
100 Program platform = await context.loadPlatform(); 102 Program platform = await context.loadPlatform();
101 Ticker ticker = new Ticker(); 103 Ticker ticker = new Ticker();
102 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator, "vm"); 104 DillTarget dillTarget = new DillTarget(
105 ticker, context.uriTranslator, "vm_fasta",
106 flags: new TargetFlags(strongMode: context.strongMode));
103 platform.unbindCanonicalNames(); 107 platform.unbindCanonicalNames();
104 dillTarget.loader.appendLibraries(platform); 108 dillTarget.loader.appendLibraries(platform);
105 KernelTarget sourceTarget = new KernelTarget(PhysicalFileSystem.instance, 109 KernelTarget sourceTarget = new KernelTarget(
106 dillTarget, context.uriTranslator, context.strongMode); 110 PhysicalFileSystem.instance, dillTarget, context.uriTranslator);
107 111
108 Program p; 112 Program p;
109 try { 113 try {
110 sourceTarget.read(description.uri); 114 sourceTarget.read(description.uri);
111 await dillTarget.buildOutlines(); 115 await dillTarget.buildOutlines();
112 await sourceTarget.buildOutlines(); 116 await sourceTarget.buildOutlines();
113 p = await sourceTarget.buildProgram(); 117 p = await sourceTarget.buildProgram();
114 } on InputError catch (e, s) { 118 } on InputError catch (e, s) {
115 return fail(null, e.error, s); 119 return fail(null, e.error, s);
116 } 120 }
(...skipping 13 matching lines...) Expand all
130 CoreTypes coreTypes = new CoreTypes(program); 134 CoreTypes coreTypes = new CoreTypes(program);
131 program = closure_conversion.transformProgram(coreTypes, program); 135 program = closure_conversion.transformProgram(coreTypes, program);
132 return pass(program); 136 return pass(program);
133 } catch (e, s) { 137 } catch (e, s) {
134 return crash(e, s); 138 return crash(e, s);
135 } 139 }
136 } 140 }
137 } 141 }
138 142
139 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); 143 main(List<String> arguments) => runMe(arguments, createContext, "testing.json");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698