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

Side by Side Diff: pkg/analyzer/test/src/context/mock_sdk.dart

Issue 2975253002: Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt. (Closed)
Patch Set: Created 3 years, 5 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
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.test.src.context.mock_sdk; 5 library analyzer.test.src.context.mock_sdk;
6 6
7 import 'package:analyzer/file_system/file_system.dart' as resource; 7 import 'package:analyzer/file_system/file_system.dart' as resource;
8 import 'package:analyzer/file_system/memory_file_system.dart' as resource; 8 import 'package:analyzer/file_system/memory_file_system.dart' as resource;
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/context/context.dart'; 10 import 'package:analyzer/src/context/context.dart';
(...skipping 12 matching lines...) Expand all
23 "html": const LibraryInfo( 23 "html": const LibraryInfo(
24 "html/dartium/html_dartium.dart", 24 "html/dartium/html_dartium.dart",
25 dart2jsPath: "html/dart2js/html_dart2js.dart"), 25 dart2jsPath: "html/dart2js/html_dart2js.dart"),
26 "math": const LibraryInfo("math/math.dart"), 26 "math": const LibraryInfo("math/math.dart"),
27 "_foreign_helper": const LibraryInfo("_internal/js_runtime/lib/foreign_helper. dart"), 27 "_foreign_helper": const LibraryInfo("_internal/js_runtime/lib/foreign_helper. dart"),
28 }; 28 };
29 '''; 29 ''';
30 30
31 const String sdkRoot = '/sdk'; 31 const String sdkRoot = '/sdk';
32 32
33 const _MockSdkLibrary _LIB_ASYNC = const _MockSdkLibrary( 33 const _MockSdkLibrary _LIB_ASYNC =
34 'dart:async', 34 const _MockSdkLibrary('dart:async', '$sdkRoot/lib/async/async.dart', '''
35 '$sdkRoot/lib/async/async.dart',
36 '''
37 library dart.async; 35 library dart.async;
38 36
39 import 'dart:math'; 37 import 'dart:math';
40 38
41 part 'stream.dart'; 39 part 'stream.dart';
42 40
43 class Future<T> { 41 class Future<T> {
44 factory Future(computation()) => null; 42 factory Future(computation()) => null;
45 factory Future.delayed(Duration duration, [T computation()]) => null; 43 factory Future.delayed(Duration duration, [T computation()]) => null;
46 factory Future.value([FutureOr<T> result]) => null; 44 factory Future.value([FutureOr<T> result]) => null;
47 45
48 static Future<List/*<T>*/> wait/*<T>*/( 46 static Future<List/*<T>*/> wait/*<T>*/(
49 Iterable<Future/*<T>*/> futures) => null; 47 Iterable<Future/*<T>*/> futures) => null;
50 Future/*<R>*/ then/*<R>*/(FutureOr/*<R>*/ onValue(T value)) => null; 48 Future/*<R>*/ then/*<R>*/(FutureOr/*<R>*/ onValue(T value)) => null;
51 49
52 Future<T> whenComplete(action()); 50 Future<T> whenComplete(action());
53 } 51 }
54 52
55 class FutureOr<T> {} 53 class FutureOr<T> {}
56 54
57 abstract class Completer<T> { 55 abstract class Completer<T> {
58 factory Completer() => null; 56 factory Completer() => null;
59 factory Completer.sync() => null; 57 factory Completer.sync() => null;
60 Future<T> get future; 58 Future<T> get future;
61 void complete([value]); 59 void complete([value]);
62 void completeError(Object error, [StackTrace stackTrace]); 60 void completeError(Object error, [StackTrace stackTrace]);
63 bool get isCompleted; 61 bool get isCompleted;
64 } 62 }
65 ''', 63 ''', const <String, String>{
66 const <String, String>{ 64 '$sdkRoot/lib/async/stream.dart': r'''
67 '$sdkRoot/lib/async/stream.dart': r'''
68 part of dart.async; 65 part of dart.async;
69 abstract class Stream<T> { 66 abstract class Stream<T> {
70 Future<T> get first; 67 Future<T> get first;
71 StreamSubscription<T> listen(void onData(T event), 68 StreamSubscription<T> listen(void onData(T event),
72 { Function onError, 69 { Function onError,
73 void onDone(), 70 void onDone(),
74 bool cancelOnError}); 71 bool cancelOnError});
75 Stream(); 72 Stream();
76 factory Stream.fromIterable(Iterable<T> data); 73 factory Stream.fromIterable(Iterable<T> data);
77 } 74 }
78 75
79 abstract class StreamSubscription<T> { 76 abstract class StreamSubscription<T> {
80 Future cancel(); 77 Future cancel();
81 void onData(void handleData(T data)); 78 void onData(void handleData(T data));
82 void onError(Function handleError); 79 void onError(Function handleError);
83 void onDone(void handleDone()); 80 void onDone(void handleDone());
84 void pause([Future resumeSignal]); 81 void pause([Future resumeSignal]);
85 void resume(); 82 void resume();
86 bool get isPaused; 83 bool get isPaused;
87 Future<E> asFuture<E>([E futureValue]); 84 Future<E> asFuture<E>([E futureValue]);
88 } 85 }
89 86
90 abstract class StreamTransformer<S, T> {} 87 abstract class StreamTransformer<S, T> {}
91 ''' 88 '''
92 }); 89 });
93 90
94 const _MockSdkLibrary _LIB_COLLECTION = const _MockSdkLibrary( 91 const _MockSdkLibrary _LIB_COLLECTION = const _MockSdkLibrary(
95 'dart:collection', 92 'dart:collection', '$sdkRoot/lib/collection/collection.dart', '''
96 '$sdkRoot/lib/collection/collection.dart',
97 '''
98 library dart.collection; 93 library dart.collection;
99 94
100 abstract class HashMap<K, V> implements Map<K, V> {} 95 abstract class HashMap<K, V> implements Map<K, V> {}
101 '''); 96 ''');
102 97
103 const _MockSdkLibrary _LIB_CONVERT = const _MockSdkLibrary( 98 const _MockSdkLibrary _LIB_CONVERT = const _MockSdkLibrary(
104 'dart:convert', 99 'dart:convert', '$sdkRoot/lib/convert/convert.dart', '''
105 '$sdkRoot/lib/convert/convert.dart',
106 '''
107 library dart.convert; 100 library dart.convert;
108 101
109 import 'dart:async'; 102 import 'dart:async';
110 103
111 abstract class Converter<S, T> implements StreamTransformer {} 104 abstract class Converter<S, T> implements StreamTransformer {}
112 class JsonDecoder extends Converter<String, Object> {} 105 class JsonDecoder extends Converter<String, Object> {}
113 '''); 106 ''');
114 107
115 const _MockSdkLibrary _LIB_CORE = const _MockSdkLibrary( 108 const _MockSdkLibrary _LIB_CORE =
116 'dart:core', 109 const _MockSdkLibrary('dart:core', '$sdkRoot/lib/core/core.dart', '''
117 '$sdkRoot/lib/core/core.dart',
118 '''
119 library dart.core; 110 library dart.core;
120 111
121 import 'dart:async'; 112 import 'dart:async';
122 113
123 class Object { 114 class Object {
124 const Object(); 115 const Object();
125 bool operator ==(other) => identical(this, other); 116 bool operator ==(other) => identical(this, other);
126 String toString() => 'a string'; 117 String toString() => 'a string';
127 int get hashCode => 0; 118 int get hashCode => 0;
128 Type get runtimeType => null; 119 Type get runtimeType => null;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 300
310 class _Proxy { const _Proxy(); } 301 class _Proxy { const _Proxy(); }
311 const Object proxy = const _Proxy(); 302 const Object proxy = const _Proxy();
312 303
313 class _Override { const _Override(); } 304 class _Override { const _Override(); }
314 const Object override = const _Override(); 305 const Object override = const _Override();
315 '''); 306 ''');
316 307
317 const _MockSdkLibrary _LIB_FOREIGN_HELPER = const _MockSdkLibrary( 308 const _MockSdkLibrary _LIB_FOREIGN_HELPER = const _MockSdkLibrary(
318 'dart:_foreign_helper', 309 'dart:_foreign_helper',
319 '$sdkRoot/lib/_foreign_helper/_foreign_helper.dart', 310 '$sdkRoot/lib/_foreign_helper/_foreign_helper.dart', '''
320 '''
321 library dart._foreign_helper; 311 library dart._foreign_helper;
322 312
323 JS(String typeDescription, String codeTemplate, 313 JS(String typeDescription, String codeTemplate,
324 [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11]) 314 [arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11])
325 {} 315 {}
326 '''); 316 ''');
327 317
328 const _MockSdkLibrary _LIB_HTML_DART2JS = const _MockSdkLibrary( 318 const _MockSdkLibrary _LIB_HTML_DART2JS = const _MockSdkLibrary(
329 'dart:html', 319 'dart:html', '$sdkRoot/lib/html/dart2js/html_dart2js.dart', '''
330 '$sdkRoot/lib/html/dart2js/html_dart2js.dart',
331 '''
332 library dart.html; 320 library dart.html;
333 class HtmlElement {} 321 class HtmlElement {}
334 '''); 322 ''');
335 323
336 const _MockSdkLibrary _LIB_HTML_DARTIUM = const _MockSdkLibrary( 324 const _MockSdkLibrary _LIB_HTML_DARTIUM = const _MockSdkLibrary(
337 'dart:html', 325 'dart:html', '$sdkRoot/lib/html/dartium/html_dartium.dart', '''
338 '$sdkRoot/lib/html/dartium/html_dartium.dart',
339 '''
340 library dart.dom.html; 326 library dart.dom.html;
341 327
342 final HtmlDocument document; 328 final HtmlDocument document;
343 329
344 abstract class Element {} 330 abstract class Element {}
345 331
346 abstract class HtmlDocument { 332 abstract class HtmlDocument {
347 Element query(String relativeSelectors) => null; 333 Element query(String relativeSelectors) => null;
348 } 334 }
349 335
(...skipping 12 matching lines...) Expand all
362 CanvasRenderingContext2D get context2D; 348 CanvasRenderingContext2D get context2D;
363 } 349 }
364 350
365 abstract class class CanvasRenderingContext2D {} 351 abstract class class CanvasRenderingContext2D {}
366 352
367 Element query(String relativeSelectors) => null; 353 Element query(String relativeSelectors) => null;
368 '''); 354 ''');
369 355
370 const _MockSdkLibrary _LIB_INTERCEPTORS = const _MockSdkLibrary( 356 const _MockSdkLibrary _LIB_INTERCEPTORS = const _MockSdkLibrary(
371 'dart:_interceptors', 357 'dart:_interceptors',
372 '$sdkRoot/lib/_internal/js_runtime/lib/interceptors.dart', 358 '$sdkRoot/lib/_internal/js_runtime/lib/interceptors.dart', '''
373 '''
374 library dart._interceptors; 359 library dart._interceptors;
375 '''); 360 ''');
376 361
377 const _MockSdkLibrary _LIB_MATH = const _MockSdkLibrary( 362 const _MockSdkLibrary _LIB_MATH =
378 'dart:math', 363 const _MockSdkLibrary('dart:math', '$sdkRoot/lib/math/math.dart', '''
379 '$sdkRoot/lib/math/math.dart',
380 '''
381 library dart.math; 364 library dart.math;
382 365
383 const double E = 2.718281828459045; 366 const double E = 2.718281828459045;
384 const double PI = 3.1415926535897932; 367 const double PI = 3.1415926535897932;
385 const double LN10 = 2.302585092994046; 368 const double LN10 = 2.302585092994046;
386 369
387 T min<T extends num>(T a, T b) => null; 370 T min<T extends num>(T a, T b) => null;
388 T max<T extends num>(T a, T b) => null; 371 T max<T extends num>(T a, T b) => null;
389 372
390 external double cos(num radians); 373 external double cos(num radians);
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 611
629 @override 612 @override
630 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { 613 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) {
631 if (factory == null) { 614 if (factory == null) {
632 return super.createCacheFromSourceFactory(factory); 615 return super.createCacheFromSourceFactory(factory);
633 } 616 }
634 return new AnalysisCache( 617 return new AnalysisCache(
635 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); 618 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]);
636 } 619 }
637 } 620 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/context/context_test.dart ('k') | pkg/analyzer/test/src/dart/analysis/driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698