| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 // TODO(ahe): Copied from closure_conversion branch of kernel, remove this file | 5 // TODO(ahe): Copied from closure_conversion branch of kernel, remove this file |
| 6 // when closure_conversion is merged with master. | 6 // when closure_conversion is merged with master. |
| 7 | 7 |
| 8 library fasta.testing.kernel_chain; | 8 library fasta.testing.kernel_chain; |
| 9 | 9 |
| 10 import 'dart:async' show Future; | 10 import 'dart:async' show Future; |
| 11 | 11 |
| 12 import 'dart:io' show Directory, File, IOSink; | 12 import 'dart:io' show Directory, File, IOSink; |
| 13 | 13 |
| 14 import 'dart:typed_data' show Uint8List; | 14 import 'dart:typed_data' show Uint8List; |
| 15 | 15 |
| 16 import 'package:kernel/kernel.dart' show loadProgramFromBinary; | 16 import 'package:kernel/kernel.dart' show loadProgramFromBinary; |
| 17 | 17 |
| 18 import 'package:kernel/target/targets.dart' show Target; | 18 import 'package:kernel/target/targets.dart' show Target; |
| 19 | 19 |
| 20 import 'package:kernel/text/ast_to_text.dart' show Printer; | 20 import 'package:kernel/text/ast_to_text.dart' show Printer; |
| 21 | 21 |
| 22 import 'package:testing/testing.dart' show Result, StdioProcess, Step; | 22 import 'package:testing/testing.dart' show Result, StdioProcess, Step; |
| 23 | 23 |
| 24 import 'package:kernel/ast.dart' show Library, Program; | 24 import 'package:kernel/ast.dart' show Library, Program; |
| 25 | 25 |
| 26 import '../kernel/verifier.dart' show verifyProgram; | 26 import '../kernel/verifier.dart' show verifyProgram; |
| 27 | 27 |
| 28 import '../compiler_command_line.dart'; |
| 29 |
| 28 import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter; | 30 import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter; |
| 29 | 31 |
| 30 import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder; | 32 import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder; |
| 31 | 33 |
| 32 import 'package:testing/testing.dart' | 34 import 'package:testing/testing.dart' |
| 33 show ChainContext, Result, StdioProcess, Step, TestDescription; | 35 show ChainContext, Result, StdioProcess, Step, TestDescription; |
| 34 | 36 |
| 35 import 'package:kernel/ast.dart' show Program; | 37 import 'package:kernel/ast.dart' show Program; |
| 36 | 38 |
| 37 import 'package:front_end/front_end.dart'; | 39 import 'package:front_end/front_end.dart'; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 58 } | 60 } |
| 59 | 61 |
| 60 class Verify extends Step<Program, Program, ChainContext> { | 62 class Verify extends Step<Program, Program, ChainContext> { |
| 61 final bool fullCompile; | 63 final bool fullCompile; |
| 62 | 64 |
| 63 const Verify(this.fullCompile); | 65 const Verify(this.fullCompile); |
| 64 | 66 |
| 65 String get name => "verify"; | 67 String get name => "verify"; |
| 66 | 68 |
| 67 Future<Result<Program>> run(Program program, ChainContext context) async { | 69 Future<Result<Program>> run(Program program, ChainContext context) async { |
| 68 var errors = verifyProgram(program, isOutline: !fullCompile); | 70 return await CompilerCommandLine.withGlobalOptions("", [""], (_) async { |
| 69 if (errors.isEmpty) { | 71 var errors = verifyProgram(program, isOutline: !fullCompile); |
| 70 return pass(program); | 72 if (errors.isEmpty) { |
| 71 } else { | 73 return pass(program); |
| 72 return new Result<Program>( | 74 } else { |
| 73 null, context.expectationSet["VerificationError"], errors, null); | 75 return new Result<Program>( |
| 74 } | 76 null, context.expectationSet["VerificationError"], errors, null); |
| 77 } |
| 78 }); |
| 75 } | 79 } |
| 76 } | 80 } |
| 77 | 81 |
| 78 class MatchExpectation extends Step<Program, Program, ChainContext> { | 82 class MatchExpectation extends Step<Program, Program, ChainContext> { |
| 79 final String suffix; | 83 final String suffix; |
| 80 | 84 |
| 81 // TODO(ahe): This is true by default which doesn't match well with the class | 85 // TODO(ahe): This is true by default which doesn't match well with the class |
| 82 // name. | 86 // name. |
| 83 final bool updateExpectations; | 87 final bool updateExpectations; |
| 84 | 88 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 253 |
| 250 Future openWrite(Uri uri, f(IOSink sink)) async { | 254 Future openWrite(Uri uri, f(IOSink sink)) async { |
| 251 IOSink sink = new File.fromUri(uri).openWrite(); | 255 IOSink sink = new File.fromUri(uri).openWrite(); |
| 252 try { | 256 try { |
| 253 await f(sink); | 257 await f(sink); |
| 254 } finally { | 258 } finally { |
| 255 await sink.close(); | 259 await sink.close(); |
| 256 } | 260 } |
| 257 print("Wrote $uri"); | 261 print("Wrote $uri"); |
| 258 } | 262 } |
| OLD | NEW |