| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine.sdk.io; | 3 library engine.sdk.io; |
| 4 import 'dart:io'; | 4 import 'dart:io'; |
| 5 import 'java_core.dart'; | 5 import 'java_core.dart'; |
| 6 import 'java_io.dart'; | 6 import 'java_io.dart'; |
| 7 import 'java_engine.dart'; | 7 import 'java_engine.dart'; |
| 8 import 'java_engine_io.dart'; | 8 import 'java_engine_io.dart'; |
| 9 import 'source_io.dart'; | 9 import 'source_io.dart'; |
| 10 import 'error.dart'; | 10 import 'error.dart'; |
| 11 import 'scanner.dart'; | 11 import 'scanner.dart'; |
| 12 import 'ast.dart'; | 12 import 'ast.dart'; |
| 13 import 'parser.dart'; | 13 import 'parser.dart'; |
| 14 import 'sdk.dart'; | 14 import 'sdk.dart'; |
| 15 import 'engine.dart'; | 15 import 'engine.dart'; |
| 16 /** | 16 /** |
| 17 * Instances of the class `DirectoryBasedDartSdk` represent a Dart SDK installed
in a | 17 * Instances of the class `DirectoryBasedDartSdk` represent a Dart SDK installed
in a |
| 18 * specified directory. | 18 * specified directory. |
| 19 * |
| 19 * @coverage dart.engine.sdk | 20 * @coverage dart.engine.sdk |
| 20 */ | 21 */ |
| 21 class DirectoryBasedDartSdk implements DartSdk { | 22 class DirectoryBasedDartSdk implements DartSdk { |
| 22 | 23 |
| 23 /** | 24 /** |
| 24 * The [AnalysisContext] which is used for all of the sources in this [DartSdk
]. | 25 * The [AnalysisContext] which is used for all of the sources in this [DartSdk
]. |
| 25 */ | 26 */ |
| 26 InternalAnalysisContext _analysisContext; | 27 InternalAnalysisContext _analysisContext; |
| 27 | 28 |
| 28 /** | 29 /** |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 static String _VM_EXECUTABLE_NAME_WIN = "dart.exe"; | 125 static String _VM_EXECUTABLE_NAME_WIN = "dart.exe"; |
| 125 | 126 |
| 126 /** | 127 /** |
| 127 * The name of the file containing the VM executable on non-Windows operating
systems. | 128 * The name of the file containing the VM executable on non-Windows operating
systems. |
| 128 */ | 129 */ |
| 129 static String _VM_EXECUTABLE_NAME = "dart"; | 130 static String _VM_EXECUTABLE_NAME = "dart"; |
| 130 | 131 |
| 131 /** | 132 /** |
| 132 * Return the default Dart SDK, or `null` if the directory containing the defa
ult SDK cannot | 133 * Return the default Dart SDK, or `null` if the directory containing the defa
ult SDK cannot |
| 133 * be determined (or does not exist). | 134 * be determined (or does not exist). |
| 135 * |
| 134 * @return the default Dart SDK | 136 * @return the default Dart SDK |
| 135 */ | 137 */ |
| 136 static DirectoryBasedDartSdk get defaultSdk { | 138 static DirectoryBasedDartSdk get defaultSdk { |
| 137 JavaFile sdkDirectory = defaultSdkDirectory; | 139 JavaFile sdkDirectory = defaultSdkDirectory; |
| 138 if (sdkDirectory == null) { | 140 if (sdkDirectory == null) { |
| 139 return null; | 141 return null; |
| 140 } | 142 } |
| 141 return new DirectoryBasedDartSdk(sdkDirectory); | 143 return new DirectoryBasedDartSdk(sdkDirectory); |
| 142 } | 144 } |
| 143 | 145 |
| 144 /** | 146 /** |
| 145 * Return the default directory for the Dart SDK, or `null` if the directory c
annot be | 147 * Return the default directory for the Dart SDK, or `null` if the directory c
annot be |
| 146 * determined (or does not exist). The default directory is provided by a [Sys
tem] property | 148 * determined (or does not exist). The default directory is provided by a [Sys
tem] property |
| 147 * named `com.google.dart.sdk`, or, if the property is not defined, an environ
ment variable | 149 * named `com.google.dart.sdk`, or, if the property is not defined, an environ
ment variable |
| 148 * named `DART_SDK`. | 150 * named `DART_SDK`. |
| 151 * |
| 149 * @return the default directory for the Dart SDK | 152 * @return the default directory for the Dart SDK |
| 150 */ | 153 */ |
| 151 static JavaFile get defaultSdkDirectory { | 154 static JavaFile get defaultSdkDirectory { |
| 152 String sdkProperty = JavaSystemIO.getProperty(_DEFAULT_DIRECTORY_PROPERTY_NA
ME); | 155 String sdkProperty = JavaSystemIO.getProperty(_DEFAULT_DIRECTORY_PROPERTY_NA
ME); |
| 153 if (sdkProperty == null) { | 156 if (sdkProperty == null) { |
| 154 sdkProperty = JavaSystemIO.getenv(_DART_SDK_ENVIRONMENT_VARIABLE_NAME); | 157 sdkProperty = JavaSystemIO.getenv(_DART_SDK_ENVIRONMENT_VARIABLE_NAME); |
| 155 if (sdkProperty == null) { | 158 if (sdkProperty == null) { |
| 156 return null; | 159 return null; |
| 157 } | 160 } |
| 158 } | 161 } |
| 159 JavaFile sdkDirectory = new JavaFile(sdkProperty); | 162 JavaFile sdkDirectory = new JavaFile(sdkProperty); |
| 160 if (!sdkDirectory.exists()) { | 163 if (!sdkDirectory.exists()) { |
| 161 return null; | 164 return null; |
| 162 } | 165 } |
| 163 return sdkDirectory; | 166 return sdkDirectory; |
| 164 } | 167 } |
| 165 | 168 |
| 166 /** | 169 /** |
| 167 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. | 170 * Initialize a newly created SDK to represent the Dart SDK installed in the g
iven directory. |
| 171 * |
| 168 * @param sdkDirectory the directory containing the SDK | 172 * @param sdkDirectory the directory containing the SDK |
| 169 */ | 173 */ |
| 170 DirectoryBasedDartSdk(JavaFile sdkDirectory) { | 174 DirectoryBasedDartSdk(JavaFile sdkDirectory) { |
| 171 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); | 175 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); |
| 172 initializeSdk(); | 176 initializeSdk(); |
| 173 initializeLibraryMap(); | 177 initializeLibraryMap(); |
| 174 _analysisContext = new AnalysisContextImpl(); | 178 _analysisContext = new AnalysisContextImpl(); |
| 175 _analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver
(this)]); | 179 _analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver
(this)]); |
| 176 List<String> uris = this.uris; | 180 List<String> uris = this.uris; |
| 177 ChangeSet changeSet = new ChangeSet(); | 181 ChangeSet changeSet = new ChangeSet(); |
| 178 for (String uri in uris) { | 182 for (String uri in uris) { |
| 179 changeSet.added(_analysisContext.sourceFactory.forUri(uri)); | 183 changeSet.added(_analysisContext.sourceFactory.forUri(uri)); |
| 180 } | 184 } |
| 181 _analysisContext.applyChanges(changeSet); | 185 _analysisContext.applyChanges(changeSet); |
| 182 } | 186 } |
| 183 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) => new F
ileBasedSource.con2(contentCache, new JavaFile.fromUri(uri), kind); | 187 Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) => new F
ileBasedSource.con2(contentCache, new JavaFile.fromUri(uri), kind); |
| 184 AnalysisContext get context => _analysisContext; | 188 AnalysisContext get context => _analysisContext; |
| 185 | 189 |
| 186 /** | 190 /** |
| 187 * Return the file containing the Dartium executable, or `null` if it does not
exist. | 191 * Return the file containing the Dartium executable, or `null` if it does not
exist. |
| 192 * |
| 188 * @return the file containing the Dartium executable | 193 * @return the file containing the Dartium executable |
| 189 */ | 194 */ |
| 190 JavaFile get dartiumExecutable { | 195 JavaFile get dartiumExecutable { |
| 191 { | 196 { |
| 192 if (_dartiumExecutable == null) { | 197 if (_dartiumExecutable == null) { |
| 193 JavaFile file = new JavaFile.relative(dartiumWorkingDirectory, dartiumBi
naryName); | 198 JavaFile file = new JavaFile.relative(dartiumWorkingDirectory, dartiumBi
naryName); |
| 194 if (file.exists()) { | 199 if (file.exists()) { |
| 195 _dartiumExecutable = file; | 200 _dartiumExecutable = file; |
| 196 } | 201 } |
| 197 } | 202 } |
| 198 } | 203 } |
| 199 return _dartiumExecutable; | 204 return _dartiumExecutable; |
| 200 } | 205 } |
| 201 | 206 |
| 202 /** | 207 /** |
| 203 * Return the directory where dartium can be found in the Dart SDK (the direct
ory that will be the | 208 * Return the directory where dartium can be found in the Dart SDK (the direct
ory that will be the |
| 204 * working directory is Dartium is invoked without changing the default). | 209 * working directory is Dartium is invoked without changing the default). |
| 210 * |
| 205 * @return the directory where dartium can be found | 211 * @return the directory where dartium can be found |
| 206 */ | 212 */ |
| 207 JavaFile get dartiumWorkingDirectory => new JavaFile.relative(_sdkDirectory.ge
tParentFile(), _CHROMIUM_DIRECTORY_NAME); | 213 JavaFile get dartiumWorkingDirectory => new JavaFile.relative(_sdkDirectory.ge
tParentFile(), _CHROMIUM_DIRECTORY_NAME); |
| 208 | 214 |
| 209 /** | 215 /** |
| 210 * Return the directory containing the SDK. | 216 * Return the directory containing the SDK. |
| 217 * |
| 211 * @return the directory containing the SDK | 218 * @return the directory containing the SDK |
| 212 */ | 219 */ |
| 213 JavaFile get directory => _sdkDirectory; | 220 JavaFile get directory => _sdkDirectory; |
| 214 | 221 |
| 215 /** | 222 /** |
| 216 * Return the directory containing documentation for the SDK. | 223 * Return the directory containing documentation for the SDK. |
| 224 * |
| 217 * @return the SDK's documentation directory | 225 * @return the SDK's documentation directory |
| 218 */ | 226 */ |
| 219 JavaFile get docDirectory => new JavaFile.relative(_sdkDirectory, _DOCS_DIRECT
ORY_NAME); | 227 JavaFile get docDirectory => new JavaFile.relative(_sdkDirectory, _DOCS_DIRECT
ORY_NAME); |
| 220 | 228 |
| 221 /** | 229 /** |
| 222 * Return the auxiliary documentation file for the given library, or `null` if
no such file | 230 * Return the auxiliary documentation file for the given library, or `null` if
no such file |
| 223 * exists. | 231 * exists. |
| 232 * |
| 224 * @param libraryName the name of the library associated with the documentatio
n file to be | 233 * @param libraryName the name of the library associated with the documentatio
n file to be |
| 225 * returned | 234 * returned |
| 226 * @return the auxiliary documentation file for the library | 235 * @return the auxiliary documentation file for the library |
| 227 */ | 236 */ |
| 228 JavaFile getDocFileFor(String libraryName) { | 237 JavaFile getDocFileFor(String libraryName) { |
| 229 JavaFile dir = docDirectory; | 238 JavaFile dir = docDirectory; |
| 230 if (!dir.exists()) { | 239 if (!dir.exists()) { |
| 231 return null; | 240 return null; |
| 232 } | 241 } |
| 233 JavaFile libDir = new JavaFile.relative(dir, libraryName); | 242 JavaFile libDir = new JavaFile.relative(dir, libraryName); |
| 234 JavaFile docFile = new JavaFile.relative(libDir, "${libraryName}${_DOC_FILE_
SUFFIX}"); | 243 JavaFile docFile = new JavaFile.relative(libDir, "${libraryName}${_DOC_FILE_
SUFFIX}"); |
| 235 if (docFile.exists()) { | 244 if (docFile.exists()) { |
| 236 return docFile; | 245 return docFile; |
| 237 } | 246 } |
| 238 return null; | 247 return null; |
| 239 } | 248 } |
| 240 | 249 |
| 241 /** | 250 /** |
| 242 * Return the directory within the SDK directory that contains the libraries. | 251 * Return the directory within the SDK directory that contains the libraries. |
| 252 * |
| 243 * @return the directory that contains the libraries | 253 * @return the directory that contains the libraries |
| 244 */ | 254 */ |
| 245 JavaFile get libraryDirectory => new JavaFile.relative(_sdkDirectory, _LIB_DIR
ECTORY_NAME); | 255 JavaFile get libraryDirectory => new JavaFile.relative(_sdkDirectory, _LIB_DIR
ECTORY_NAME); |
| 246 List<SdkLibrary> get sdkLibraries => _libraryMap.sdkLibraries; | 256 List<SdkLibrary> get sdkLibraries => _libraryMap.sdkLibraries; |
| 247 SdkLibrary getSdkLibrary(String dartUri) => _libraryMap.getLibrary(dartUri); | 257 SdkLibrary getSdkLibrary(String dartUri) => _libraryMap.getLibrary(dartUri); |
| 248 | 258 |
| 249 /** | 259 /** |
| 250 * Return the revision number of this SDK, or `"0"` if the revision number can
not be | 260 * Return the revision number of this SDK, or `"0"` if the revision number can
not be |
| 251 * discovered. | 261 * discovered. |
| 262 * |
| 252 * @return the revision number of this SDK | 263 * @return the revision number of this SDK |
| 253 */ | 264 */ |
| 254 String get sdkVersion { | 265 String get sdkVersion { |
| 255 { | 266 { |
| 256 if (_sdkVersion == null) { | 267 if (_sdkVersion == null) { |
| 257 _sdkVersion = DartSdk.DEFAULT_VERSION; | 268 _sdkVersion = DartSdk.DEFAULT_VERSION; |
| 258 JavaFile revisionFile = new JavaFile.relative(_sdkDirectory, _REVISION_F
ILE_NAME); | 269 JavaFile revisionFile = new JavaFile.relative(_sdkDirectory, _REVISION_F
ILE_NAME); |
| 259 try { | 270 try { |
| 260 String revision = revisionFile.readAsStringSync(); | 271 String revision = revisionFile.readAsStringSync(); |
| 261 if (revision != null) { | 272 if (revision != null) { |
| 262 _sdkVersion = revision; | 273 _sdkVersion = revision; |
| 263 } | 274 } |
| 264 } on IOException catch (exception) { | 275 } on IOException catch (exception) { |
| 265 } | 276 } |
| 266 } | 277 } |
| 267 } | 278 } |
| 268 return _sdkVersion; | 279 return _sdkVersion; |
| 269 } | 280 } |
| 270 | 281 |
| 271 /** | 282 /** |
| 272 * Return an array containing the library URI's for the libraries defined in t
his SDK. | 283 * Return an array containing the library URI's for the libraries defined in t
his SDK. |
| 284 * |
| 273 * @return the library URI's for the libraries defined in this SDK | 285 * @return the library URI's for the libraries defined in this SDK |
| 274 */ | 286 */ |
| 275 List<String> get uris => _libraryMap.uris; | 287 List<String> get uris => _libraryMap.uris; |
| 276 | 288 |
| 277 /** | 289 /** |
| 278 * Return the file containing the VM executable, or `null` if it does not exis
t. | 290 * Return the file containing the VM executable, or `null` if it does not exis
t. |
| 291 * |
| 279 * @return the file containing the VM executable | 292 * @return the file containing the VM executable |
| 280 */ | 293 */ |
| 281 JavaFile get vmExecutable { | 294 JavaFile get vmExecutable { |
| 282 { | 295 { |
| 283 if (_vmExecutable == null) { | 296 if (_vmExecutable == null) { |
| 284 JavaFile file = new JavaFile.relative(new JavaFile.relative(_sdkDirector
y, _BIN_DIRECTORY_NAME), binaryName); | 297 JavaFile file = new JavaFile.relative(new JavaFile.relative(_sdkDirector
y, _BIN_DIRECTORY_NAME), binaryName); |
| 285 if (file.exists()) { | 298 if (file.exists()) { |
| 286 _vmExecutable = file; | 299 _vmExecutable = file; |
| 287 } | 300 } |
| 288 } | 301 } |
| 289 } | 302 } |
| 290 return _vmExecutable; | 303 return _vmExecutable; |
| 291 } | 304 } |
| 292 | 305 |
| 293 /** | 306 /** |
| 294 * Return `true` if this SDK includes documentation. | 307 * Return `true` if this SDK includes documentation. |
| 308 * |
| 295 * @return `true` if this installation of the SDK has documentation | 309 * @return `true` if this installation of the SDK has documentation |
| 296 */ | 310 */ |
| 297 bool hasDocumentation() => docDirectory.exists(); | 311 bool hasDocumentation() => docDirectory.exists(); |
| 298 | 312 |
| 299 /** | 313 /** |
| 300 * Return `true` if the Dartium binary is available. | 314 * Return `true` if the Dartium binary is available. |
| 315 * |
| 301 * @return `true` if the Dartium binary is available | 316 * @return `true` if the Dartium binary is available |
| 302 */ | 317 */ |
| 303 bool get isDartiumInstalled => dartiumExecutable != null; | 318 bool get isDartiumInstalled => dartiumExecutable != null; |
| 304 Source mapDartUri(ContentCache contentCache, String dartUri) { | 319 Source mapDartUri(ContentCache contentCache, String dartUri) { |
| 305 SdkLibrary library = getSdkLibrary(dartUri); | 320 SdkLibrary library = getSdkLibrary(dartUri); |
| 306 if (library == null) { | 321 if (library == null) { |
| 307 return null; | 322 return null; |
| 308 } | 323 } |
| 309 return new FileBasedSource.con2(contentCache, new JavaFile.relative(libraryD
irectory, library.path), UriKind.DART_URI); | 324 return new FileBasedSource.con2(contentCache, new JavaFile.relative(libraryD
irectory, library.path), UriKind.DART_URI); |
| 310 } | 325 } |
| 311 | 326 |
| 312 /** | 327 /** |
| 313 * Ensure that the dart VM is executable. If it is not, make it executable and
log that it was | 328 * Ensure that the dart VM is executable. If it is not, make it executable and
log that it was |
| 314 * necessary for us to do so. | 329 * necessary for us to do so. |
| 315 */ | 330 */ |
| 316 void ensureVmIsExecutable() { | 331 void ensureVmIsExecutable() { |
| 317 } | 332 } |
| 318 | 333 |
| 319 /** | 334 /** |
| 320 * Return the name of the file containing the VM executable. | 335 * Return the name of the file containing the VM executable. |
| 336 * |
| 321 * @return the name of the file containing the VM executable | 337 * @return the name of the file containing the VM executable |
| 322 */ | 338 */ |
| 323 String get binaryName { | 339 String get binaryName { |
| 324 if (OSUtilities.isWindows()) { | 340 if (OSUtilities.isWindows()) { |
| 325 return _VM_EXECUTABLE_NAME_WIN; | 341 return _VM_EXECUTABLE_NAME_WIN; |
| 326 } else { | 342 } else { |
| 327 return _VM_EXECUTABLE_NAME; | 343 return _VM_EXECUTABLE_NAME; |
| 328 } | 344 } |
| 329 } | 345 } |
| 330 | 346 |
| 331 /** | 347 /** |
| 332 * Return the name of the file containing the Dartium executable. | 348 * Return the name of the file containing the Dartium executable. |
| 349 * |
| 333 * @return the name of the file containing the Dartium executable | 350 * @return the name of the file containing the Dartium executable |
| 334 */ | 351 */ |
| 335 String get dartiumBinaryName { | 352 String get dartiumBinaryName { |
| 336 if (OSUtilities.isWindows()) { | 353 if (OSUtilities.isWindows()) { |
| 337 return _DARTIUM_EXECUTABLE_NAME_WIN; | 354 return _DARTIUM_EXECUTABLE_NAME_WIN; |
| 338 } else if (OSUtilities.isMac()) { | 355 } else if (OSUtilities.isMac()) { |
| 339 return _DARTIUM_EXECUTABLE_NAME_MAC; | 356 return _DARTIUM_EXECUTABLE_NAME_MAC; |
| 340 } else { | 357 } else { |
| 341 return _DARTIUM_EXECUTABLE_NAME_LINUX; | 358 return _DARTIUM_EXECUTABLE_NAME_LINUX; |
| 342 } | 359 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 365 } | 382 } |
| 366 } | 383 } |
| 367 } | 384 } |
| 368 /** | 385 /** |
| 369 * Instances of the class `SdkLibrariesReader` read and parse the libraries file | 386 * Instances of the class `SdkLibrariesReader` read and parse the libraries file |
| 370 * (dart-sdk/lib/_internal/libraries.dart) for information about the libraries i
n an SDK. The | 387 * (dart-sdk/lib/_internal/libraries.dart) for information about the libraries i
n an SDK. The |
| 371 * library information is represented as a Dart file containing a single top-lev
el variable whose | 388 * library information is represented as a Dart file containing a single top-lev
el variable whose |
| 372 * value is a const map. The keys of the map are the names of libraries defined
in the SDK and the | 389 * value is a const map. The keys of the map are the names of libraries defined
in the SDK and the |
| 373 * values in the map are info objects defining the library. For example, a subse
t of a typical SDK | 390 * values in the map are info objects defining the library. For example, a subse
t of a typical SDK |
| 374 * might have a libraries file that looks like the following: | 391 * might have a libraries file that looks like the following: |
| 392 * |
| 375 * <pre> | 393 * <pre> |
| 376 * final Map<String, LibraryInfo> LIBRARIES = const <LibraryInfo> { | 394 * final Map<String, LibraryInfo> LIBRARIES = const <LibraryInfo> { |
| 377 * // Used by VM applications | 395 * // Used by VM applications |
| 378 * "builtin" : const LibraryInfo( | 396 * "builtin" : const LibraryInfo( |
| 379 * "builtin/builtin_runtime.dart", | 397 * "builtin/builtin_runtime.dart", |
| 380 * category: "Server", | 398 * category: "Server", |
| 381 * platforms: VM_PLATFORM), | 399 * platforms: VM_PLATFORM), |
| 382 * "compiler" : const LibraryInfo( | 400 * |
| 383 * "compiler/compiler.dart", | 401 * "compiler" : const LibraryInfo( |
| 384 * category: "Tools", | 402 * "compiler/compiler.dart", |
| 385 * platforms: 0), | 403 * category: "Tools", |
| 404 * platforms: 0), |
| 386 * }; | 405 * }; |
| 387 * </pre> | 406 * </pre> |
| 407 * |
| 388 * @coverage dart.engine.sdk | 408 * @coverage dart.engine.sdk |
| 389 */ | 409 */ |
| 390 class SdkLibrariesReader { | 410 class SdkLibrariesReader { |
| 391 | 411 |
| 392 /** | 412 /** |
| 393 * Return the library map read from the given source. | 413 * Return the library map read from the given source. |
| 414 * |
| 394 * @return the library map read from the given source | 415 * @return the library map read from the given source |
| 395 */ | 416 */ |
| 396 LibraryMap readFrom(JavaFile librariesFile, String libraryFileContents) { | 417 LibraryMap readFrom(JavaFile librariesFile, String libraryFileContents) { |
| 397 List<bool> foundError = [false]; | 418 List<bool> foundError = [false]; |
| 398 AnalysisErrorListener errorListener = new AnalysisErrorListener_8(foundError
); | 419 AnalysisErrorListener errorListener = new AnalysisErrorListener_9(foundError
); |
| 399 Source source = new FileBasedSource.con2(null, librariesFile, UriKind.FILE_U
RI); | 420 Source source = new FileBasedSource.con2(null, librariesFile, UriKind.FILE_U
RI); |
| 400 StringScanner scanner = new StringScanner(source, libraryFileContents, error
Listener); | 421 StringScanner scanner = new StringScanner(source, libraryFileContents, error
Listener); |
| 401 Parser parser = new Parser(source, errorListener); | 422 Parser parser = new Parser(source, errorListener); |
| 402 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); | 423 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize()); |
| 403 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li
braryBuilder(); | 424 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li
braryBuilder(); |
| 404 if (!foundError[0]) { | 425 if (!foundError[0]) { |
| 405 unit.accept(libraryBuilder); | 426 unit.accept(libraryBuilder); |
| 406 } | 427 } |
| 407 return libraryBuilder.librariesMap; | 428 return libraryBuilder.librariesMap; |
| 408 } | 429 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 431 */ | 452 */ |
| 432 static String _CATEGORY = "category"; | 453 static String _CATEGORY = "category"; |
| 433 | 454 |
| 434 /** | 455 /** |
| 435 * The name of the optional parameter used to specify the platforms on which t
he library can be | 456 * The name of the optional parameter used to specify the platforms on which t
he library can be |
| 436 * used. | 457 * used. |
| 437 */ | 458 */ |
| 438 static String _PLATFORMS = "platforms"; | 459 static String _PLATFORMS = "platforms"; |
| 439 | 460 |
| 440 /** | 461 /** |
| 441 * The value of the [PLATFORMS platforms] parameter used to specify that the l
ibrary can | 462 * The value of the [PLATFORMS] parameter used to specify that the library can |
| 442 * be used on the VM. | 463 * be used on the VM. |
| 443 */ | 464 */ |
| 444 static String _VM_PLATFORM = "VM_PLATFORM"; | 465 static String _VM_PLATFORM = "VM_PLATFORM"; |
| 445 | 466 |
| 446 /** | 467 /** |
| 447 * The library map that is populated by visiting the AST structure parsed from
the contents of | 468 * The library map that is populated by visiting the AST structure parsed from
the contents of |
| 448 * the libraries file. | 469 * the libraries file. |
| 449 */ | 470 */ |
| 450 LibraryMap _librariesMap = new LibraryMap(); | 471 LibraryMap _librariesMap = new LibraryMap(); |
| 451 | 472 |
| 452 /** | 473 /** |
| 453 * Return the library map that was populated by visiting the AST structure par
sed from the | 474 * Return the library map that was populated by visiting the AST structure par
sed from the |
| 454 * contents of the libraries file. | 475 * contents of the libraries file. |
| 476 * |
| 455 * @return the library map describing the contents of the SDK | 477 * @return the library map describing the contents of the SDK |
| 456 */ | 478 */ |
| 457 LibraryMap get librariesMap => _librariesMap; | 479 LibraryMap get librariesMap => _librariesMap; |
| 458 Object visitMapLiteralEntry(MapLiteralEntry node) { | 480 Object visitMapLiteralEntry(MapLiteralEntry node) { |
| 459 String libraryName = null; | 481 String libraryName = null; |
| 460 Expression key = node.key; | 482 Expression key = node.key; |
| 461 if (key is SimpleStringLiteral) { | 483 if (key is SimpleStringLiteral) { |
| 462 libraryName = "${_LIBRARY_PREFIX}${((key as SimpleStringLiteral)).value}"; | 484 libraryName = "${_LIBRARY_PREFIX}${((key as SimpleStringLiteral)).value}"; |
| 463 } | 485 } |
| 464 Expression value = node.value; | 486 Expression value = node.value; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 487 } | 509 } |
| 488 } | 510 } |
| 489 } | 511 } |
| 490 } | 512 } |
| 491 } | 513 } |
| 492 _librariesMap.setLibrary(libraryName, library); | 514 _librariesMap.setLibrary(libraryName, library); |
| 493 } | 515 } |
| 494 return null; | 516 return null; |
| 495 } | 517 } |
| 496 } | 518 } |
| 497 class AnalysisErrorListener_8 implements AnalysisErrorListener { | 519 class AnalysisErrorListener_9 implements AnalysisErrorListener { |
| 498 List<bool> foundError; | 520 List<bool> foundError; |
| 499 AnalysisErrorListener_8(this.foundError); | 521 AnalysisErrorListener_9(this.foundError); |
| 500 void onError(AnalysisError error) { | 522 void onError(AnalysisError error) { |
| 501 foundError[0] = true; | 523 foundError[0] = true; |
| 502 } | 524 } |
| 503 } | 525 } |
| OLD | NEW |