Add --analyzer-use-fasta and --analyzer-use-fasta-parser to test.py

When these flags are used, the flags "--use-cfe" and
"--use-fasta-parser" are passed to the dartanalyzer command.
(The compiler -cdart2analyzer runs the dartanalyzer compiler).
The variables $analyzer_use_fasta and $analyzer_use_fasta_parser are
available in status files, and the $fasta variable is set in both
cases.

Change-Id: Ic42033fb8fb3a19431f380abdf949564758c8d7b
BUG: dartbug.com/33510
Reviewed-on: https://dart-review.googlesource.com/62302
Reviewed-by: Devon Carew <devoncarew@google.com>
diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
index 757ef01..c474bd7 100644
--- a/tools/testing/dart/compiler_configuration.dart
+++ b/tools/testing/dart/compiler_configuration.dart
@@ -1011,8 +1011,10 @@
     } else {
       arguments.add('--no-strong');
     }
-    if (_configuration.compiler == Compiler.dart2analyzer &&
-        _configuration.usesFasta) {
+    if (_configuration.useAnalyzerCfe) {
+      arguments.add('--use-cfe');
+    }
+    if (_configuration.useAnalyzerFastaParser) {
       arguments.add('--use-fasta-parser');
     }
 
diff --git a/tools/testing/dart/configuration.dart b/tools/testing/dart/configuration.dart
index e78b2d4..80808c3 100644
--- a/tools/testing/dart/configuration.dart
+++ b/tools/testing/dart/configuration.dart
@@ -46,6 +46,8 @@
       this.reportInJson,
       this.resetBrowser,
       this.skipCompilation,
+      this.useAnalyzerCfe,
+      this.useAnalyzerFastaParser,
       this.useBlobs,
       this.useSdk,
       this.useFastStartup,
@@ -120,6 +122,8 @@
   final bool reportInJson;
   final bool resetBrowser;
   final bool skipCompilation;
+  final bool useAnalyzerCfe;
+  final bool useAnalyzerFastaParser;
   final bool useBlobs;
   final bool useSdk;
   final bool useFastStartup;
@@ -194,7 +198,7 @@
     return fastaCompilers.contains(compiler) ||
         (compiler == Compiler.dart2js && !useDart2JSOldFrontend) ||
         (compiler == Compiler.dart2analyzer &&
-            builderTag == 'analyzer_use_fasta');
+            (builderTag == 'analyzer_use_fasta' || useAnalyzerCfe));
   }
 
   /// The base directory named for this configuration, like:
@@ -471,6 +475,8 @@
         'fast_startup': useFastStartup,
         'timeout': timeout,
         'no_preview_dart_2': noPreviewDart2,
+        'use_cfe': useAnalyzerCfe,
+        'analyzer_use_fasta_parser': useAnalyzerFastaParser,
         'dart2js_with_kernel': useDart2JSWithKernel,
         'dart2js_old_frontend': useDart2JSOldFrontend,
         'enable_asserts': useEnableAsserts,
diff --git a/tools/testing/dart/environment.dart b/tools/testing/dart/environment.dart
index 55397f8..f0bda0dd 100644
--- a/tools/testing/dart/environment.dart
+++ b/tools/testing/dart/environment.dart
@@ -13,6 +13,8 @@
 // consider adding support for "!" to status expressions.
 final _variables = {
   "analyzer": new _Variable.bool((c) => c.compiler == Compiler.dart2analyzer),
+  "analyzer_use_fasta_parser":
+      new _Variable.bool((c) => c.useAnalyzerFastaParser),
   "arch": new _Variable((c) => c.architecture.name, Architecture.names),
   "browser": new _Variable.bool((c) => c.runtime.isBrowser),
   "builder_tag": new _Variable((c) => c.builderTag ?? "", const []),
diff --git a/tools/testing/dart/options.dart b/tools/testing/dart/options.dart
index 5296bd1..fb29a71 100644
--- a/tools/testing/dart/options.dart
+++ b/tools/testing/dart/options.dart
@@ -173,6 +173,12 @@
     new _Option.bool(
         'no_preview_dart_2', 'Pass the --no-preview-dart-2 flag to analyzer',
         hide: true),
+    new _Option.bool('use_cfe', 'Pass the --use-cfe flag to analyzer',
+        hide: true),
+    new _Option.bool('analyzer_use_fasta_parser',
+        'Pass the --use-fasta-parser flag to analyzer',
+        hide: true),
+
     // TODO(sigmund): replace dart2js_with_kernel with preview-dart-2.
     new _Option.bool(
         'dart2js_with_kernel', 'Pass the --use-kernel flag to dart2js.',
@@ -656,6 +662,9 @@
                 reportInJson: data["report_in_json"] as bool,
                 resetBrowser: data["reset_browser_configuration"] as bool,
                 skipCompilation: data["skip_compilation"] as bool,
+                useAnalyzerCfe: data["use_cfe"] as bool,
+                useAnalyzerFastaParser:
+                    data["analyzer_use_fasta_parser"] as bool,
                 useBlobs: data["use_blobs"] as bool,
                 useSdk: data["use_sdk"] as bool,
                 useFastStartup: data["fast_startup"] as bool,