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

Side by Side Diff: pkg/analyzer/lib/src/generated/sdk_io.dart

Issue 259773005: New analyzer snapshot. Sorted unit members. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/generated/sdk.dart ('k') | pkg/analyzer/lib/src/generated/source.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.sdk.io; 8 library engine.sdk.io;
9 9
10 import 'java_core.dart'; 10 import 'java_core.dart';
11 import 'java_io.dart'; 11 import 'java_io.dart';
12 import 'java_engine_io.dart'; 12 import 'java_engine_io.dart';
13 import 'source_io.dart'; 13 import 'source_io.dart';
14 import 'error.dart'; 14 import 'error.dart';
15 import 'scanner.dart'; 15 import 'scanner.dart';
16 import 'ast.dart'; 16 import 'ast.dart';
17 import 'parser.dart'; 17 import 'parser.dart';
18 import 'sdk.dart'; 18 import 'sdk.dart';
19 import 'engine.dart'; 19 import 'engine.dart';
20 20
21 /** 21 /**
22 * Instances of the class `SdkLibrariesReader` read and parse the libraries file
23 * (dart-sdk/lib/_internal/libraries.dart) for information about the libraries i n an SDK. The
24 * library information is represented as a Dart file containing a single top-lev el variable whose
25 * value is a const map. The keys of the map are the names of libraries defined in the SDK and the
26 * values in the map are info objects defining the library. For example, a subse t of a typical SDK
27 * might have a libraries file that looks like the following:
28 *
29 * <pre>
30 * final Map&lt;String, LibraryInfo&gt; LIBRARIES = const &lt;LibraryInfo&gt; {
31 * // Used by VM applications
32 * "builtin" : const LibraryInfo(
33 * "builtin/builtin_runtime.dart",
34 * category: "Server",
35 * platforms: VM_PLATFORM),
36 *
37 * "compiler" : const LibraryInfo(
38 * "compiler/compiler.dart",
39 * category: "Tools",
40 * platforms: 0),
41 * };
42 * </pre>
43 */
44 class SdkLibrariesReader {
45 /**
46 * A flag indicating whether the dart2js path should be used when it is availa ble.
47 */
48 final bool _useDart2jsPaths;
49
50 /**
51 * Initialize a newly created library reader to use the dart2js path if the gi ven value is
52 * `true`.
53 *
54 * @param useDart2jsPaths `true` if the dart2js path should be used when it is available
55 */
56 SdkLibrariesReader(this._useDart2jsPaths);
57
58 /**
59 * Return the library map read from the given source.
60 *
61 * @param file the [File] of the library file
62 * @param libraryFileContents the contents from the library file
63 * @return the library map read from the given source
64 */
65 LibraryMap readFromFile(JavaFile file, String libraryFileContents) => readFrom Source(new FileBasedSource.con2(file, UriKind.FILE_URI), libraryFileContents);
66
67 /**
68 * Return the library map read from the given source.
69 *
70 * @param source the source of the library file
71 * @param libraryFileContents the contents from the library file
72 * @return the library map read from the given source
73 */
74 LibraryMap readFromSource(Source source, String libraryFileContents) {
75 BooleanErrorListener errorListener = new BooleanErrorListener();
76 Scanner scanner = new Scanner(source, new CharSequenceReader(libraryFileCont ents), errorListener);
77 Parser parser = new Parser(source, errorListener);
78 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize());
79 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li braryBuilder(_useDart2jsPaths);
80 // If any syntactic errors were found then don't try to visit the AST struct ure.
81 if (!errorListener.errorReported) {
82 unit.accept(libraryBuilder);
83 }
84 return libraryBuilder.librariesMap;
85 }
86 }
87
88 /**
89 * Instances of the class `DirectoryBasedDartSdk` represent a Dart SDK installed in a 22 * Instances of the class `DirectoryBasedDartSdk` represent a Dart SDK installed in a
90 * specified directory. Typical Dart SDK layout is something like... 23 * specified directory. Typical Dart SDK layout is something like...
91 * 24 *
92 * <pre> 25 * <pre>
93 * dart-sdk/ 26 * dart-sdk/
94 * bin/ 27 * bin/
95 * dart[.exe] <-- VM 28 * dart[.exe] <-- VM
96 * lib/ 29 * lib/
97 * core/ 30 * core/
98 * core.dart 31 * core.dart
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 } 477 }
545 } 478 }
546 479
547 /** 480 /**
548 * Verify that the given executable file exists and is executable. 481 * Verify that the given executable file exists and is executable.
549 * 482 *
550 * @param file the binary file 483 * @param file the binary file
551 * @return the file if it exists and is executable, else `null` 484 * @return the file if it exists and is executable, else `null`
552 */ 485 */
553 JavaFile _verifyExecutable(JavaFile file) => file.isExecutable() ? file : null ; 486 JavaFile _verifyExecutable(JavaFile file) => file.isExecutable() ? file : null ;
487 }
488
489 /**
490 * Instances of the class `SdkLibrariesReader` read and parse the libraries file
491 * (dart-sdk/lib/_internal/libraries.dart) for information about the libraries i n an SDK. The
492 * library information is represented as a Dart file containing a single top-lev el variable whose
493 * value is a const map. The keys of the map are the names of libraries defined in the SDK and the
494 * values in the map are info objects defining the library. For example, a subse t of a typical SDK
495 * might have a libraries file that looks like the following:
496 *
497 * <pre>
498 * final Map&lt;String, LibraryInfo&gt; LIBRARIES = const &lt;LibraryInfo&gt; {
499 * // Used by VM applications
500 * "builtin" : const LibraryInfo(
501 * "builtin/builtin_runtime.dart",
502 * category: "Server",
503 * platforms: VM_PLATFORM),
504 *
505 * "compiler" : const LibraryInfo(
506 * "compiler/compiler.dart",
507 * category: "Tools",
508 * platforms: 0),
509 * };
510 * </pre>
511 */
512 class SdkLibrariesReader {
513 /**
514 * A flag indicating whether the dart2js path should be used when it is availa ble.
515 */
516 final bool _useDart2jsPaths;
517
518 /**
519 * Initialize a newly created library reader to use the dart2js path if the gi ven value is
520 * `true`.
521 *
522 * @param useDart2jsPaths `true` if the dart2js path should be used when it is available
523 */
524 SdkLibrariesReader(this._useDart2jsPaths);
525
526 /**
527 * Return the library map read from the given source.
528 *
529 * @param file the [File] of the library file
530 * @param libraryFileContents the contents from the library file
531 * @return the library map read from the given source
532 */
533 LibraryMap readFromFile(JavaFile file, String libraryFileContents) => readFrom Source(new FileBasedSource.con2(file, UriKind.FILE_URI), libraryFileContents);
534
535 /**
536 * Return the library map read from the given source.
537 *
538 * @param source the source of the library file
539 * @param libraryFileContents the contents from the library file
540 * @return the library map read from the given source
541 */
542 LibraryMap readFromSource(Source source, String libraryFileContents) {
543 BooleanErrorListener errorListener = new BooleanErrorListener();
544 Scanner scanner = new Scanner(source, new CharSequenceReader(libraryFileCont ents), errorListener);
545 Parser parser = new Parser(source, errorListener);
546 CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize());
547 SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_Li braryBuilder(_useDart2jsPaths);
548 // If any syntactic errors were found then don't try to visit the AST struct ure.
549 if (!errorListener.errorReported) {
550 unit.accept(libraryBuilder);
551 }
552 return libraryBuilder.librariesMap;
553 }
554 } 554 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/sdk.dart ('k') | pkg/analyzer/lib/src/generated/source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698