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

Unified Diff: pkg/front_end/lib/src/fasta/environment_variable.dart

Issue 2828583003: remove dependencies to analyzer from lib/src/fasta (Closed)
Patch Set: rebase Created 3 years, 8 months 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
Index: pkg/front_end/lib/src/fasta/environment_variable.dart
diff --git a/pkg/front_end/lib/src/fasta/environment_variable.dart b/pkg/front_end/lib/src/fasta/environment_variable.dart
deleted file mode 100644
index dfd2dc66e8e339affd1af25790c6144c537b517c..0000000000000000000000000000000000000000
--- a/pkg/front_end/lib/src/fasta/environment_variable.dart
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2016, 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.
-
-library fasta.environment_variable;
-
-import 'dart:async' show Future;
-
-import 'dart:io' show Directory, File, Platform;
-
-import 'errors.dart' show inputError;
-
-class EnvironmentVariable {
- final String name;
-
- final String what;
-
- const EnvironmentVariable(this.name, this.what);
-
- Future<String> get value async {
- String value = Platform.environment[name];
- if (value == null) return variableNotDefined();
- await validate(value);
- return value;
- }
-
- Future<Null> validate(String value) => new Future<Null>.value();
-
- variableNotDefined() {
- inputError(
- null, null, "The environment variable '$name' isn't defined. $what");
- }
-}
-
-class EnvironmentVariableFile extends EnvironmentVariable {
- const EnvironmentVariableFile(String name, String what) : super(name, what);
-
- Future<Null> validate(String value) async {
- if (!await new File(value).exists()) notFound(value);
- return null;
- }
-
- notFound(String value) {
- inputError(
- null,
- null,
- "The environment variable '$name' has the value "
- "'$value', that isn't a file. $what");
- }
-}
-
-class EnvironmentVariableDirectory extends EnvironmentVariable {
- const EnvironmentVariableDirectory(String name, String what)
- : super(name, what);
-
- Future<Null> validate(String value) async {
- if (!await new Directory(value).exists()) notFound(value);
- return null;
- }
-
- notFound(String value) {
- inputError(
- null,
- null,
- "The environment variable '$name' has the value "
- "'$value', that isn't a directory. $what");
- }
-}
-
-Future<bool> fileExists(Uri base, String path) async {
- return await new File.fromUri(base.resolve(path)).exists();
-}

Powered by Google App Engine
This is Rietveld 408576698