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

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

Issue 135653008: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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
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; 8 library engine.sdk;
9 9
10 import 'source.dart' show ContentCache, Source, UriKind; 10 import 'source.dart' show ContentCache, Source, UriKind;
11 import 'ast.dart';
11 import 'engine.dart' show AnalysisContext; 12 import 'engine.dart' show AnalysisContext;
12 13
13 /** 14 /**
14 * Represents a single library in the SDK 15 * Represents a single library in the SDK
15 */ 16 */
16 abstract class SdkLibrary { 17 abstract class SdkLibrary {
17 /** 18 /**
18 * Return the name of the category containing the library. 19 * Return the name of the category containing the library.
19 * 20 *
20 * @return the name of the category containing the library 21 * @return the name of the category containing the library
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 188 }
188 189
189 /** 190 /**
190 * Record that this library can be run on the VM. 191 * Record that this library can be run on the VM.
191 */ 192 */
192 void setVmLibrary() { 193 void setVmLibrary() {
193 _platforms |= VM_PLATFORM; 194 _platforms |= VM_PLATFORM;
194 } 195 }
195 } 196 }
196 197
198 class SdkLibrariesReader_LibraryBuilder extends RecursiveASTVisitor<Object> {
199 /**
200 * The prefix added to the name of a library to form the URI used in code to r eference the
201 * library.
202 */
203 static String _LIBRARY_PREFIX = "dart:";
204
205 /**
206 * The name of the optional parameter used to indicate whether the library is an implementation
207 * library.
208 */
209 static String _IMPLEMENTATION = "implementation";
210
211 /**
212 * The name of the optional parameter used to indicate whether the library is documented.
213 */
214 static String _DOCUMENTED = "documented";
215
216 /**
217 * The name of the optional parameter used to specify the category of the libr ary.
218 */
219 static String _CATEGORY = "category";
220
221 /**
222 * The name of the optional parameter used to specify the platforms on which t he library can be
223 * used.
224 */
225 static String _PLATFORMS = "platforms";
226
227 /**
228 * The value of the [PLATFORMS] parameter used to specify that the library can
229 * be used on the VM.
230 */
231 static String _VM_PLATFORM = "VM_PLATFORM";
232
233 /**
234 * The library map that is populated by visiting the AST structure parsed from the contents of
235 * the libraries file.
236 */
237 final LibraryMap librariesMap = new LibraryMap();
238
239 Object visitMapLiteralEntry(MapLiteralEntry node) {
240 String libraryName = null;
241 Expression key = node.key;
242 if (key is SimpleStringLiteral) {
243 libraryName = "${_LIBRARY_PREFIX}${key.value}";
244 }
245 Expression value = node.value;
246 if (value is InstanceCreationExpression) {
247 SdkLibraryImpl library = new SdkLibraryImpl(libraryName);
248 List<Expression> arguments = value.argumentList.arguments;
249 for (Expression argument in arguments) {
250 if (argument is SimpleStringLiteral) {
251 library.path = argument.value;
252 } else if (argument is NamedExpression) {
253 String name = argument.name.label.name;
254 Expression expression = argument.expression;
255 if (name == _CATEGORY) {
256 library.category = (expression as SimpleStringLiteral).value;
257 } else if (name == _IMPLEMENTATION) {
258 library.implementation = (expression as BooleanLiteral).value;
259 } else if (name == _DOCUMENTED) {
260 library.documented = (expression as BooleanLiteral).value;
261 } else if (name == _PLATFORMS) {
262 if (expression is SimpleIdentifier) {
263 String identifier = expression.name;
264 if (identifier == _VM_PLATFORM) {
265 library.setVmLibrary();
266 } else {
267 library.setDart2JsLibrary();
268 }
269 }
270 }
271 }
272 }
273 librariesMap.setLibrary(libraryName, library);
274 }
275 return null;
276 }
277 }
278
197 /** 279 /**
198 * Instances of the class `LibraryMap` map Dart library URI's to the [SdkLibrary Impl 280 * Instances of the class `LibraryMap` map Dart library URI's to the [SdkLibrary Impl
199 ]. 281 ].
200 * 282 *
201 * @coverage dart.engine.sdk 283 * @coverage dart.engine.sdk
202 */ 284 */
203 class LibraryMap { 285 class LibraryMap {
204 /** 286 /**
205 * A table mapping Dart library URI's to the library. 287 * A table mapping Dart library URI's to the library.
206 */ 288 */
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 400
319 /** 401 /**
320 * Return the source representing the library with the given `dart:` URI, or ` null` if 402 * Return the source representing the library with the given `dart:` URI, or ` null` if
321 * the given URI does not denote a library in this SDK. 403 * the given URI does not denote a library in this SDK.
322 * 404 *
323 * @param dartUri the URI of the library to be returned 405 * @param dartUri the URI of the library to be returned
324 * @return the source representing the specified library 406 * @return the source representing the specified library
325 */ 407 */
326 Source mapDartUri(String dartUri); 408 Source mapDartUri(String dartUri);
327 } 409 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698