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

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

Issue 1691603002: Get rid of redundant MockSdk. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Remove strong mode's copy of mock SDK. Created 4 years, 10 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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/all_the_rest_test.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 library analyzer.src.generated.sdk; 5 library analyzer.src.generated.sdk;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
11 import 'package:analyzer/src/generated/engine.dart' 11 import 'package:analyzer/src/generated/engine.dart'
12 show AnalysisContext, AnalysisOptions; 12 show AnalysisContext, AnalysisOptions;
13 import 'package:analyzer/src/generated/source.dart' 13 import 'package:analyzer/src/generated/source.dart'
14 show ContentCache, Source, UriKind; 14 show ContentCache, Source, UriKind;
15 15
16 /** 16 /**
17 * A function used to create a new DartSdk 17 * A function used to create a new DartSdk
18 */ 18 */
19 typedef DartSdk SdkCreator(); 19 typedef DartSdk SdkCreator();
20 20
21 /** 21 /**
22 * A Dart SDK installed in a specified location. 22 * A Dart SDK installed in a specified location.
23 */ 23 */
24 abstract class DartSdk { 24 abstract class DartSdk {
25 /** 25 /**
26 * The short name of the dart SDK 'async' library. 26 * The short name of the dart SDK 'async' library.
27 */ 27 */
28 static final String DART_ASYNC = "dart:async"; 28 static const String DART_ASYNC = "dart:async";
29 29
30 /** 30 /**
31 * The short name of the dart SDK 'core' library. 31 * The short name of the dart SDK 'core' library.
32 */ 32 */
33 static final String DART_CORE = "dart:core"; 33 static const String DART_CORE = "dart:core";
34 34
35 /** 35 /**
36 * The short name of the dart SDK 'html' library. 36 * The short name of the dart SDK 'html' library.
37 */ 37 */
38 static final String DART_HTML = "dart:html"; 38 static const String DART_HTML = "dart:html";
39 39
40 /** 40 /**
41 * The version number that is returned when the real version number could not 41 * The version number that is returned when the real version number could not
42 * be determined. 42 * be determined.
43 */ 43 */
44 static final String DEFAULT_VERSION = "0"; 44 static const String DEFAULT_VERSION = "0";
45 45
46 /** 46 /**
47 * Return the analysis context used for all of the sources in this [DartSdk]. 47 * Return the analysis context used for all of the sources in this [DartSdk].
48 */ 48 */
49 AnalysisContext get context; 49 AnalysisContext get context;
50 50
51 /** 51 /**
52 * Return a list containing all of the libraries defined in this SDK. 52 * Return a list containing all of the libraries defined in this SDK.
53 */ 53 */
54 List<SdkLibrary> get sdkLibraries; 54 List<SdkLibrary> get sdkLibraries;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 for (Expression argument in arguments) { 273 for (Expression argument in arguments) {
274 if (argument is SimpleStringLiteral) { 274 if (argument is SimpleStringLiteral) {
275 library.path = argument.value; 275 library.path = argument.value;
276 } else if (argument is NamedExpression) { 276 } else if (argument is NamedExpression) {
277 String name = argument.name.label.name; 277 String name = argument.name.label.name;
278 Expression expression = argument.expression; 278 Expression expression = argument.expression;
279 if (name == _CATEGORIES) { 279 if (name == _CATEGORIES) {
280 library.category = 280 library.category =
281 convertCategories((expression as StringLiteral).stringValue); 281 convertCategories((expression as StringLiteral).stringValue);
282 } else if (name == _IMPLEMENTATION) { 282 } else if (name == _IMPLEMENTATION) {
283 library.implementation = (expression as BooleanLiteral).value; 283 library._implementation = (expression as BooleanLiteral).value;
284 } else if (name == _DOCUMENTED) { 284 } else if (name == _DOCUMENTED) {
285 library.documented = (expression as BooleanLiteral).value; 285 library.documented = (expression as BooleanLiteral).value;
286 } else if (name == _PLATFORMS) { 286 } else if (name == _PLATFORMS) {
287 if (expression is SimpleIdentifier) { 287 if (expression is SimpleIdentifier) {
288 String identifier = expression.name; 288 String identifier = expression.name;
289 if (identifier == _VM_PLATFORM) { 289 if (identifier == _VM_PLATFORM) {
290 library.setVmLibrary(); 290 library.setVmLibrary();
291 } else { 291 } else {
292 library.setDart2JsLibrary(); 292 library.setDart2JsLibrary();
293 } 293 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 */ 413 */
414 SdkLibraryImpl(this.shortName); 414 SdkLibraryImpl(this.shortName);
415 415
416 /** 416 /**
417 * Set whether the library is documented. 417 * Set whether the library is documented.
418 */ 418 */
419 void set documented(bool documented) { 419 void set documented(bool documented) {
420 this._documented = documented; 420 this._documented = documented;
421 } 421 }
422 422
423 /**
424 * Set whether the library is an implementation library.
425 */
426 void set implementation(bool implementation) {
427 this._implementation = implementation;
428 }
429
430 @override 423 @override
431 bool get isDart2JsLibrary => (_platforms & DART2JS_PLATFORM) != 0; 424 bool get isDart2JsLibrary => (_platforms & DART2JS_PLATFORM) != 0;
432 425
433 @override 426 @override
434 bool get isDocumented => _documented; 427 bool get isDocumented => _documented;
435 428
436 @override 429 @override
437 bool get isImplementation => _implementation; 430 bool get isImplementation => _implementation;
438 431
439 @override 432 @override
440 bool get isInternal => "Internal" == category; 433 bool get isInternal => category == "Internal";
441 434
442 @override 435 @override
443 bool get isShared => category == "Shared"; 436 bool get isShared => category == "Shared";
444 437
445 @override 438 @override
446 bool get isVmLibrary => (_platforms & VM_PLATFORM) != 0; 439 bool get isVmLibrary => (_platforms & VM_PLATFORM) != 0;
447 440
448 /** 441 /**
449 * Record that this library can be compiled to JavaScript by dart2js. 442 * Record that this library can be compiled to JavaScript by dart2js.
450 */ 443 */
451 void setDart2JsLibrary() { 444 void setDart2JsLibrary() {
452 _platforms |= DART2JS_PLATFORM; 445 _platforms |= DART2JS_PLATFORM;
453 } 446 }
454 447
455 /** 448 /**
456 * Record that this library can be run on the VM. 449 * Record that this library can be run on the VM.
457 */ 450 */
458 void setVmLibrary() { 451 void setVmLibrary() {
459 _platforms |= VM_PLATFORM; 452 _platforms |= VM_PLATFORM;
460 } 453 }
461 } 454 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/all_the_rest_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698