OLD | NEW |
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 19 matching lines...) Expand all Loading... |
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; | 38 import 'package:kernel/target/targets.dart' show TargetFlags; |
39 | 39 |
| 40 import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget; |
| 41 |
40 import 'package:kernel/interpreter/interpreter.dart'; | 42 import 'package:kernel/interpreter/interpreter.dart'; |
41 | 43 |
42 const String STRONG_MODE = " strong mode "; | 44 const String STRONG_MODE = " strong mode "; |
43 | 45 |
44 class InterpreterContext extends ChainContext { | 46 class InterpreterContext 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; |
(...skipping 25 matching lines...) Expand all Loading... |
75 | 77 |
76 class FastaCompile extends Step<TestDescription, Program, InterpreterContext> { | 78 class FastaCompile extends Step<TestDescription, Program, InterpreterContext> { |
77 const FastaCompile(); | 79 const FastaCompile(); |
78 | 80 |
79 String get name => "fasta compile"; | 81 String get name => "fasta compile"; |
80 | 82 |
81 Future<Result<Program>> run( | 83 Future<Result<Program>> run( |
82 TestDescription description, InterpreterContext context) async { | 84 TestDescription description, InterpreterContext context) async { |
83 Program platform = await context.loadPlatform(); | 85 Program platform = await context.loadPlatform(); |
84 Ticker ticker = new Ticker(); | 86 Ticker ticker = new Ticker(); |
85 DillTarget dillTarget = new DillTarget( | 87 DillTarget dillTarget = new DillTarget(ticker, context.uriTranslator, |
86 ticker, context.uriTranslator, "vm_fasta", | 88 new VmFastaTarget(new TargetFlags(strongMode: context.strongMode))); |
87 flags: new TargetFlags(strongMode: context.strongMode)); | |
88 platform.unbindCanonicalNames(); | 89 platform.unbindCanonicalNames(); |
89 dillTarget.loader.appendLibraries(platform); | 90 dillTarget.loader.appendLibraries(platform); |
90 KernelTarget sourceTarget = new KernelTarget( | 91 KernelTarget sourceTarget = new KernelTarget( |
91 PhysicalFileSystem.instance, dillTarget, context.uriTranslator); | 92 PhysicalFileSystem.instance, dillTarget, context.uriTranslator); |
92 | 93 |
93 Program p; | 94 Program p; |
94 try { | 95 try { |
95 sourceTarget.read(description.uri); | 96 sourceTarget.read(description.uri); |
96 await dillTarget.buildOutlines(); | 97 await dillTarget.buildOutlines(); |
97 await sourceTarget.buildOutlines(); | 98 await sourceTarget.buildOutlines(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 final Uri uri; | 158 final Uri uri; |
158 | 159 |
159 /// Evaluated program log. | 160 /// Evaluated program log. |
160 final String log; | 161 final String log; |
161 | 162 |
162 EvaluationLog(this.uri, this.log); | 163 EvaluationLog(this.uri, this.log); |
163 } | 164 } |
164 | 165 |
165 main(List<String> arguments) => | 166 main(List<String> arguments) => |
166 runMe(arguments, InterpreterContext.create, "testing.json"); | 167 runMe(arguments, InterpreterContext.create, "testing.json"); |
OLD | NEW |