| Index: pkg/analyzer_experimental/lib/src/generated/sdk_io.dart
|
| ===================================================================
|
| --- pkg/analyzer_experimental/lib/src/generated/sdk_io.dart (revision 23549)
|
| +++ pkg/analyzer_experimental/lib/src/generated/sdk_io.dart (working copy)
|
| @@ -16,103 +16,122 @@
|
| import 'sdk.dart';
|
| import 'engine.dart';
|
|
|
| +
|
| /**
|
| * Instances of the class {@code DirectoryBasedDartSdk} represent a Dart SDK installed in a
|
| * specified directory.
|
| * @coverage dart.engine.sdk
|
| */
|
| class DirectoryBasedDartSdk implements DartSdk {
|
| +
|
| /**
|
| * The {@link AnalysisContext} which is used for all of the sources in this {@link DartSdk}.
|
| */
|
| InternalAnalysisContext _analysisContext;
|
| +
|
| /**
|
| * The directory containing the SDK.
|
| */
|
| JavaFile _sdkDirectory;
|
| +
|
| /**
|
| * The revision number of this SDK, or {@code "0"} if the revision number cannot be discovered.
|
| */
|
| String _sdkVersion;
|
| +
|
| /**
|
| * The file containing the Dartium executable.
|
| */
|
| JavaFile _dartiumExecutable;
|
| +
|
| /**
|
| * The file containing the VM executable.
|
| */
|
| JavaFile _vmExecutable;
|
| +
|
| /**
|
| * A mapping from Dart library URI's to the library represented by that URI.
|
| */
|
| LibraryMap _libraryMap;
|
| +
|
| /**
|
| * The name of the directory within the SDK directory that contains executables.
|
| */
|
| static String _BIN_DIRECTORY_NAME = "bin";
|
| +
|
| /**
|
| * The name of the directory within the SDK directory that contains Chromium.
|
| */
|
| static String _CHROMIUM_DIRECTORY_NAME = "chromium";
|
| +
|
| /**
|
| * The name of the environment variable whose value is the path to the default Dart SDK directory.
|
| */
|
| static String _DART_SDK_ENVIRONMENT_VARIABLE_NAME = "DART_SDK";
|
| +
|
| /**
|
| * The name of the file containing the Dartium executable on Linux.
|
| */
|
| static String _DARTIUM_EXECUTABLE_NAME_LINUX = "chrome";
|
| +
|
| /**
|
| * The name of the file containing the Dartium executable on Macintosh.
|
| */
|
| static String _DARTIUM_EXECUTABLE_NAME_MAC = "Chromium.app/Contents/MacOS/Chromium";
|
| +
|
| /**
|
| * The name of the file containing the Dartium executable on Windows.
|
| */
|
| static String _DARTIUM_EXECUTABLE_NAME_WIN = "Chrome.exe";
|
| +
|
| /**
|
| * The name of the {@link System} property whose value is the path to the default Dart SDK
|
| * directory.
|
| */
|
| static String _DEFAULT_DIRECTORY_PROPERTY_NAME = "com.google.dart.sdk";
|
| +
|
| /**
|
| - * The version number that is returned when the real version number could not be determined.
|
| - */
|
| - static String _DEFAULT_VERSION = "0";
|
| - /**
|
| * The name of the directory within the SDK directory that contains documentation for the
|
| * libraries.
|
| */
|
| static String _DOCS_DIRECTORY_NAME = "docs";
|
| +
|
| /**
|
| * The suffix added to the name of a library to derive the name of the file containing the
|
| * documentation for that library.
|
| */
|
| static String _DOC_FILE_SUFFIX = "_api.json";
|
| +
|
| /**
|
| * The name of the directory within the SDK directory that contains the libraries file.
|
| */
|
| static String _INTERNAL_DIR = "_internal";
|
| +
|
| /**
|
| * The name of the directory within the SDK directory that contains the libraries.
|
| */
|
| static String _LIB_DIRECTORY_NAME = "lib";
|
| +
|
| /**
|
| * The name of the libraries file.
|
| */
|
| static String _LIBRARIES_FILE = "libraries.dart";
|
| +
|
| /**
|
| * The name of the file within the SDK directory that contains the revision number of the SDK.
|
| */
|
| static String _REVISION_FILE_NAME = "revision";
|
| +
|
| /**
|
| * The name of the file containing the VM executable on the Windows operating system.
|
| */
|
| static String _VM_EXECUTABLE_NAME_WIN = "dart.exe";
|
| +
|
| /**
|
| * The name of the file containing the VM executable on non-Windows operating systems.
|
| */
|
| static String _VM_EXECUTABLE_NAME = "dart";
|
| +
|
| /**
|
| * Return the default Dart SDK, or {@code null} if the directory containing the default SDK cannot
|
| * be determined (or does not exist).
|
| @@ -125,6 +144,7 @@
|
| }
|
| return new DirectoryBasedDartSdk(sdkDirectory);
|
| }
|
| +
|
| /**
|
| * Return the default directory for the Dart SDK, or {@code null} if the directory cannot be
|
| * determined (or does not exist). The default directory is provided by a {@link System} property
|
| @@ -146,6 +166,7 @@
|
| }
|
| return sdkDirectory;
|
| }
|
| +
|
| /**
|
| * Initialize a newly created SDK to represent the Dart SDK installed in the given directory.
|
| * @param sdkDirectory the directory containing the SDK
|
| @@ -165,6 +186,7 @@
|
| }
|
| Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) => new FileBasedSource.con2(contentCache, new JavaFile.fromUri(uri), kind);
|
| AnalysisContext get context => _analysisContext;
|
| +
|
| /**
|
| * Return the file containing the Dartium executable, or {@code null} if it does not exist.
|
| * @return the file containing the Dartium executable
|
| @@ -180,22 +202,26 @@
|
| }
|
| return _dartiumExecutable;
|
| }
|
| +
|
| /**
|
| * Return the directory where dartium can be found in the Dart SDK (the directory that will be the
|
| * working directory is Dartium is invoked without changing the default).
|
| * @return the directory where dartium can be found
|
| */
|
| JavaFile get dartiumWorkingDirectory => new JavaFile.relative(_sdkDirectory.getParentFile(), _CHROMIUM_DIRECTORY_NAME);
|
| +
|
| /**
|
| * Return the directory containing the SDK.
|
| * @return the directory containing the SDK
|
| */
|
| JavaFile get directory => _sdkDirectory;
|
| +
|
| /**
|
| * Return the directory containing documentation for the SDK.
|
| * @return the SDK's documentation directory
|
| */
|
| JavaFile get docDirectory => new JavaFile.relative(_sdkDirectory, _DOCS_DIRECTORY_NAME);
|
| +
|
| /**
|
| * Return the auxiliary documentation file for the given library, or {@code null} if no such file
|
| * exists.
|
| @@ -215,12 +241,15 @@
|
| }
|
| return null;
|
| }
|
| +
|
| /**
|
| * Return the directory within the SDK directory that contains the libraries.
|
| * @return the directory that contains the libraries
|
| */
|
| JavaFile get libraryDirectory => new JavaFile.relative(_sdkDirectory, _LIB_DIRECTORY_NAME);
|
| List<SdkLibrary> get sdkLibraries => _libraryMap.sdkLibraries;
|
| + SdkLibrary getSdkLibrary(String dartUri) => _libraryMap.getLibrary(dartUri);
|
| +
|
| /**
|
| * Return the revision number of this SDK, or {@code "0"} if the revision number cannot be
|
| * discovered.
|
| @@ -229,7 +258,7 @@
|
| String get sdkVersion {
|
| {
|
| if (_sdkVersion == null) {
|
| - _sdkVersion = _DEFAULT_VERSION;
|
| + _sdkVersion = DartSdk.DEFAULT_VERSION;
|
| JavaFile revisionFile = new JavaFile.relative(_sdkDirectory, _REVISION_FILE_NAME);
|
| try {
|
| String revision = revisionFile.readAsStringSync();
|
| @@ -242,11 +271,13 @@
|
| }
|
| return _sdkVersion;
|
| }
|
| +
|
| /**
|
| * Return an array containing the library URI's for the libraries defined in this SDK.
|
| * @return the library URI's for the libraries defined in this SDK
|
| */
|
| List<String> get uris => _libraryMap.uris;
|
| +
|
| /**
|
| * Return the file containing the VM executable, or {@code null} if it does not exist.
|
| * @return the file containing the VM executable
|
| @@ -262,29 +293,33 @@
|
| }
|
| return _vmExecutable;
|
| }
|
| +
|
| /**
|
| * Return {@code true} if this SDK includes documentation.
|
| * @return {@code true} if this installation of the SDK has documentation
|
| */
|
| bool hasDocumentation() => docDirectory.exists();
|
| +
|
| /**
|
| * Return {@code true} if the Dartium binary is available.
|
| * @return {@code true} if the Dartium binary is available
|
| */
|
| bool isDartiumInstalled() => dartiumExecutable != null;
|
| Source mapDartUri(ContentCache contentCache, String dartUri) {
|
| - SdkLibrary library = _libraryMap.getLibrary(dartUri);
|
| + SdkLibrary library = getSdkLibrary(dartUri);
|
| if (library == null) {
|
| return null;
|
| }
|
| return new FileBasedSource.con2(contentCache, new JavaFile.relative(libraryDirectory, library.path), UriKind.DART_URI);
|
| }
|
| +
|
| /**
|
| * Ensure that the dart VM is executable. If it is not, make it executable and log that it was
|
| * necessary for us to do so.
|
| */
|
| void ensureVmIsExecutable() {
|
| }
|
| +
|
| /**
|
| * Return the name of the file containing the VM executable.
|
| * @return the name of the file containing the VM executable
|
| @@ -296,6 +331,7 @@
|
| return _VM_EXECUTABLE_NAME;
|
| }
|
| }
|
| +
|
| /**
|
| * Return the name of the file containing the Dartium executable.
|
| * @return the name of the file containing the Dartium executable
|
| @@ -309,6 +345,7 @@
|
| return _DARTIUM_EXECUTABLE_NAME_LINUX;
|
| }
|
| }
|
| +
|
| /**
|
| * Read all of the configuration files to initialize the library maps.
|
| */
|
| @@ -322,6 +359,7 @@
|
| _libraryMap = new LibraryMap();
|
| }
|
| }
|
| +
|
| /**
|
| * Initialize the state of the SDK.
|
| */
|
| @@ -331,6 +369,7 @@
|
| }
|
| }
|
| }
|
| +
|
| /**
|
| * Instances of the class {@code SdkLibrariesReader} read and parse the libraries file
|
| * (dart-sdk/lib/_internal/libraries.dart) for information about the libraries in an SDK. The
|
| @@ -354,13 +393,14 @@
|
| * @coverage dart.engine.sdk
|
| */
|
| class SdkLibrariesReader {
|
| +
|
| /**
|
| * Return the library map read from the given source.
|
| * @return the library map read from the given source
|
| */
|
| LibraryMap readFrom(JavaFile librariesFile, String libraryFileContents) {
|
| List<bool> foundError = [false];
|
| - AnalysisErrorListener errorListener = new AnalysisErrorListener_10(foundError);
|
| + AnalysisErrorListener errorListener = new AnalysisErrorListener_9(foundError);
|
| Source source = new FileBasedSource.con2(null, librariesFile, UriKind.FILE_URI);
|
| StringScanner scanner = new StringScanner(source, libraryFileContents, errorListener);
|
| Parser parser = new Parser(source, errorListener);
|
| @@ -373,39 +413,47 @@
|
| }
|
| }
|
| class SdkLibrariesReader_LibraryBuilder extends RecursiveASTVisitor<Object> {
|
| +
|
| /**
|
| * The prefix added to the name of a library to form the URI used in code to reference the
|
| * library.
|
| */
|
| static String _LIBRARY_PREFIX = "dart:";
|
| +
|
| /**
|
| * The name of the optional parameter used to indicate whether the library is an implementation
|
| * library.
|
| */
|
| static String _IMPLEMENTATION = "implementation";
|
| +
|
| /**
|
| * The name of the optional parameter used to indicate whether the library is documented.
|
| */
|
| static String _DOCUMENTED = "documented";
|
| +
|
| /**
|
| * The name of the optional parameter used to specify the category of the library.
|
| */
|
| static String _CATEGORY = "category";
|
| +
|
| /**
|
| * The name of the optional parameter used to specify the platforms on which the library can be
|
| * used.
|
| */
|
| static String _PLATFORMS = "platforms";
|
| +
|
| /**
|
| * The value of the {@link #PLATFORMS platforms} parameter used to specify that the library can
|
| * be used on the VM.
|
| */
|
| static String _VM_PLATFORM = "VM_PLATFORM";
|
| +
|
| /**
|
| * The library map that is populated by visiting the AST structure parsed from the contents of
|
| * the libraries file.
|
| */
|
| LibraryMap _librariesMap = new LibraryMap();
|
| +
|
| /**
|
| * Return the library map that was populated by visiting the AST structure parsed from the
|
| * contents of the libraries file.
|
| @@ -451,9 +499,9 @@
|
| return null;
|
| }
|
| }
|
| -class AnalysisErrorListener_10 implements AnalysisErrorListener {
|
| +class AnalysisErrorListener_9 implements AnalysisErrorListener {
|
| List<bool> foundError;
|
| - AnalysisErrorListener_10(this.foundError);
|
| + AnalysisErrorListener_9(this.foundError);
|
| void onError(AnalysisError error) {
|
| foundError[0] = true;
|
| }
|
|
|