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

Unified Diff: pkg/dev_compiler/test/codegen_test.dart

Issue 2584293003: DDC/AnalyzerCLI common cmdline option processing (Closed)
Patch Set: address comments Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/command.dart ('k') | pkg/dev_compiler/web/web_command.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/test/codegen_test.dart
diff --git a/pkg/dev_compiler/test/codegen_test.dart b/pkg/dev_compiler/test/codegen_test.dart
index 66ee94e5240fe1604ceb79aa5334076ca527f1ad..4c4446cfb619d13753198b0dbeca5c5e912f4335 100644
--- a/pkg/dev_compiler/test/codegen_test.dart
+++ b/pkg/dev_compiler/test/codegen_test.dart
@@ -21,7 +21,7 @@ import 'package:analyzer/analyzer.dart'
UriBasedDirective,
parseDirectives;
import 'package:analyzer/src/command_line/arguments.dart'
- show extractDefinedVariables;
+ show defineAnalysisArguments;
import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/generated/source.dart' show Source;
import 'package:args/args.dart' show ArgParser, ArgResults;
@@ -79,7 +79,7 @@ main(List<String> arguments) {
.where((p) => p.endsWith('.sum'))
.toList();
- var sharedCompiler = new ModuleCompiler(new AnalyzerOptions(
+ var sharedCompiler = new ModuleCompiler(new AnalyzerOptions.basic(
dartSdkSummaryPath: sdkSummaryFile, summaryPaths: summaryPaths));
var testDirs = [
@@ -104,6 +104,8 @@ main(List<String> arguments) {
// Our default compiler options. Individual tests can override these.
var defaultOptions = ['--no-source-map', '--no-summarize'];
var compileArgParser = new ArgParser();
+ defineAnalysisArguments(compileArgParser, ddc: true);
+ AnalyzerOptions.addArguments(compileArgParser);
CompilerOptions.addArguments(compileArgParser);
addModuleFormatOptions(compileArgParser);
@@ -138,16 +140,12 @@ main(List<String> arguments) {
args.addAll(matchedArgs.where((s) => !ignoreOptions.contains(s)));
}
- var declaredVars = <String, String>{};
- args = extractDefinedVariables(args, declaredVars);
- ArgResults argResults;
- try {
- argResults = compileArgParser.parse(args);
- } catch (e) {
- print('Failed to parse $args');
- rethrow;
- }
+ ArgResults argResults = compileArgParser.parse(args);
+ var analyzerOptions = new AnalyzerOptions.fromArguments(argResults,
+ dartSdkSummaryPath: sdkSummaryFile, summaryPaths: summaryPaths);
+
var options = new CompilerOptions.fromArguments(argResults);
+
var moduleFormat = parseModuleFormatOption(argResults).first;
// Collect any other files we've imported.
@@ -157,11 +155,8 @@ main(List<String> arguments) {
name, path.dirname(testFile), files.toList(), _moduleForLibrary);
var compiler = sharedCompiler;
- if (declaredVars.isNotEmpty) {
- compiler = new ModuleCompiler(new AnalyzerOptions(
- dartSdkSummaryPath: sdkSummaryFile,
- summaryPaths: summaryPaths,
- declaredVariables: declaredVars));
+ if (analyzerOptions.declaredVariables.isNotEmpty) {
+ compiler = new ModuleCompiler(analyzerOptions);
}
var module = compiler.compile(unit, options);
« no previous file with comments | « pkg/dev_compiler/lib/src/compiler/command.dart ('k') | pkg/dev_compiler/web/web_command.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698