<commit_before>// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Most of the code from tools/testing/dart/environment.dart.
// TODO(mkroghj) add package with all settings, such as these
// and also information about test-suites.

import 'package:status_file/environment.dart';
import 'result_json_models.dart';
import 'configurations.dart';

typedef String _LookUpFunction(Configuration configuration);
typedef bool _BoolLookUpFunction(Configuration configuration);

// TODO(29756): Instead of synthesized negated variables like "unchecked",
// consider adding support for "!" to status expressions.
final _variables = {
  "analyzer":
      new _Variable.bool((c) => c.compiler == Compiler.dart2analyzer.name),
  "arch": new _Variable((c) => c.arch, Architecture.names),
  "browser": new _Variable.bool((c) {
    var runtime = runtimeFromName(c.runtime);
    return runtime != null ? runtime.isBrowser : false;
  }),
  "builder_tag": new _Variable((c) => c.builderTag ?? "", const []),
  "checked": new _Variable.bool((c) => c.checked),
  "compiler": new _Variable((c) => c.compiler, Compiler.names),
  "csp": new _Variable.bool((c) => c.csp),
  "dart2js_with_kernel": new _Variable.bool((c) => c.dart2JsWithKernel),
  "dart2js_old_frontend": new _Variable.bool((c) => c.dart2JsOldFrontend),
  "fasta": new _Variable.bool((c) => c.fasta),
  "fast_startup": new _Variable.bool((c) => c.fastStartup),
  "enable_asserts": new _Variable.bool((c) => c.enableAsserts),
  "host_checked": new _Variable.bool((c) => c.hostChecked),
  "host_unchecked": new _Variable.bool((c) => !c.hostChecked),
  "hot_reload": new _Variable.bool((c) => c.hotReload),
  "hot_reload_rollback": new _Variable.bool((c) => c.hotReloadRollback),
  "ie": new _Variable.bool((c) {
    var runtime = runtimeFromName(c.runtime);
    return runtime != null ? runtime.isIE : false;
  }),
  "jscl": new _Variable.bool((c) {
    var runtime = runtimeFromName(c.runtime);
    return runtime != null ? runtime.isJSCommandLine : false;
  }),
  "minified": new _Variable.bool((c) => c.minified),
  "mode": new _Variable((c) => c.mode, Mode.names),
  "runtime": new _Variable(_runtimeName, Runtime.names),
  "spec_parser": new _Variable.bool((c) => c.compiler == Compiler.specParser),
  "strong": new _Variable.bool((c) => c.strong),
  "system": new _Variable((c) => c.system, System.names),
  "use_sdk": new _Variable.bool((c) => c.useSdk)
};
<commit_msg>[infra] Support preview_dart_2 in status update tool<commit_after>// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// Most of the code from tools/testing/dart/environment.dart.
// TODO(mkroghj) add package with all settings, such as these
// and also information about test-suites.

import 'package:status_file/environment.dart';
import 'result_json_models.dart';
import 'configurations.dart';

typedef String _LookUpFunction(Configuration configuration);
typedef bool _BoolLookUpFunction(Configuration configuration);

// TODO(29756): Instead of synthesized negated variables like "unchecked",
// consider adding support for "!" to status expressions.
final _variables = {
  "analyzer":
      new _Variable.bool((c) => c.compiler == Compiler.dart2analyzer.name),
  "arch": new _Variable((c) => c.arch, Architecture.names),
  "browser": new _Variable.bool((c) {
    var runtime = runtimeFromName(c.runtime);
    return runtime != null ? runtime.isBrowser : false;
  }),
  "builder_tag": new _Variable((c) => c.builderTag ?? "", const []),
  "checked": new _Variable.bool((c) => c.checked),
  "compiler": new _Variable((c) => c.compiler, Compiler.names),
  "csp": new _Variable.bool((c) => c.csp),
  "dart2js_with_kernel": new _Variable.bool((c) => c.dart2JsWithKernel),
  "dart2js_old_frontend": new _Variable.bool((c) => c.dart2JsOldFrontend),
  "fasta": new _Variable.bool((c) => c.fasta),
  "fast_startup": new _Variable.bool((c) => c.fastStartup),
  "enable_asserts": new _Variable.bool((c) => c.enableAsserts),
  "host_checked": new _Variable.bool((c) => c.hostChecked),
  "host_unchecked": new _Variable.bool((c) => !c.hostChecked),
  "hot_reload": new _Variable.bool((c) => c.hotReload),
  "hot_reload_rollback": new _Variable.bool((c) => c.hotReloadRollback),
  "ie": new _Variable.bool((c) {
    var runtime = runtimeFromName(c.runtime);
    return runtime != null ? runtime.isIE : false;
  }),
  "jscl": new _Variable.bool((c) {
    var runtime = runtimeFromName(c.runtime);
    return runtime != null ? runtime.isJSCommandLine : false;
  }),
  "minified": new _Variable.bool((c) => c.minified),
  "mode": new _Variable((c) => c.mode, Mode.names),
  "preview_dart_2": new _Variable.bool((c) => c.previewDart2),
  "runtime": new _Variable(_runtimeName, Runtime.names),
  "spec_parser": new _Variable.bool((c) => c.compiler == Compiler.specParser),
  "strong": new _Variable.bool((c) => c.strong),
  "system": new _Variable((c) => c.system, System.names),
  "use_sdk": new _Variable.bool((c) => c.useSdk)
};

{'fraction_non_alphanumeric': 0.15995440729483282, 'fraction_numerical': 0.005889057750759878, 'mean_word_length': 4.7730263157894735, 'pattern_counts': {'":': 51, '<': 3, '<?xml version=': 0, '>': 46, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7149701', 'n_tokens_mistral': 1751, 'n_tokens_neox': 1716, 'n_words': 442}