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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 import 'dart:io'; | 4 import 'dart:io'; |
5 | 5 |
6 import 'package:kernel/analyzer/loader.dart'; | 6 import 'package:kernel/analyzer/loader.dart'; |
7 import 'package:kernel/application_root.dart'; | 7 import 'package:kernel/application_root.dart'; |
8 import 'package:kernel/kernel.dart'; | 8 import 'package:kernel/kernel.dart'; |
9 import 'package:kernel/target/targets.dart'; | 9 import 'package:kernel/target/targets.dart'; |
10 import 'package:kernel/text/ast_to_text.dart'; | 10 import 'package:kernel/text/ast_to_text.dart'; |
(...skipping 26 matching lines...) Expand all Loading... |
37 for (FileSystemEntity file in directory.listSync()) { | 37 for (FileSystemEntity file in directory.listSync()) { |
38 if (file is File && file.path.endsWith('.dart')) { | 38 if (file is File && file.path.endsWith('.dart')) { |
39 String name = pathlib.basename(file.path); | 39 String name = pathlib.basename(file.path); |
40 test(name, () async { | 40 test(name, () async { |
41 Uri dartPath = | 41 Uri dartPath = |
42 new Uri(scheme: 'file', path: pathlib.absolute(file.path)); | 42 new Uri(scheme: 'file', path: pathlib.absolute(file.path)); |
43 String shortName = pathlib.withoutExtension(name); | 43 String shortName = pathlib.withoutExtension(name); |
44 String filenameOfBaseline = '$outputDirectory/$shortName.baseline.txt'; | 44 String filenameOfBaseline = '$outputDirectory/$shortName.baseline.txt'; |
45 String filenameOfCurrent = '$outputDirectory/$shortName.current.txt'; | 45 String filenameOfCurrent = '$outputDirectory/$shortName.current.txt'; |
46 | 46 |
47 var repository = new Repository(); | 47 var program = new Program(); |
48 var loader = await batch.getLoader( | 48 var loader = await batch.getLoader( |
49 repository, | 49 program, |
50 new DartOptions( | 50 new DartOptions( |
51 strongMode: target.strongMode, | 51 strongMode: target.strongMode, |
52 sdk: sdkDirectory, | 52 sdk: sdkDirectory, |
53 declaredVariables: target.extraDeclaredVariables, | 53 declaredVariables: target.extraDeclaredVariables, |
54 applicationRoot: applicationRoot)); | 54 applicationRoot: applicationRoot)); |
55 var program = loader.loadProgram(dartPath, target: target); | 55 loader.loadProgram(dartPath, target: target); |
56 verifyProgram(program); | 56 verifyProgram(program); |
57 var errors = <String>[]; | 57 var errors = <String>[]; |
58 errors.addAll(target.performModularTransformations(program)); | 58 errors.addAll(target.performModularTransformations(program)); |
59 verifyProgram(program); | 59 verifyProgram(program); |
60 errors.addAll(target.performGlobalTransformations(program)); | 60 errors.addAll(target.performGlobalTransformations(program)); |
61 verifyProgram(program); | 61 verifyProgram(program); |
62 | 62 |
63 var buffer = new StringBuffer(); | 63 var buffer = new StringBuffer(); |
64 for (var error in errors) { | 64 for (var error in errors) { |
65 buffer.writeln('// $error'); | 65 buffer.writeln('// $error'); |
(...skipping 14 matching lines...) Expand all Loading... |
80 ' rm $filenameOfBaseline\n' | 80 ' rm $filenameOfBaseline\n' |
81 'Command to see the diff:\n' | 81 'Command to see the diff:\n' |
82 ' diff -cd $outputDirectory/$shortName.{baseline,current}.txt' | 82 ' diff -cd $outputDirectory/$shortName.{baseline,current}.txt' |
83 '\n'); | 83 '\n'); |
84 } | 84 } |
85 } | 85 } |
86 }); | 86 }); |
87 } | 87 } |
88 } | 88 } |
89 } | 89 } |
OLD | NEW |