| OLD | NEW |
| 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 test.src.mock_sdk; | 5 library test.src.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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 const Object deprecated = const Deprecated("next release"); | 79 const Object deprecated = const Deprecated("next release"); |
| 80 | 80 |
| 81 class Iterator<E> { | 81 class Iterator<E> { |
| 82 bool moveNext(); | 82 bool moveNext(); |
| 83 E get current; | 83 E get current; |
| 84 } | 84 } |
| 85 | 85 |
| 86 abstract class Iterable<E> { | 86 abstract class Iterable<E> { |
| 87 Iterator<E> get iterator; | 87 Iterator<E> get iterator; |
| 88 bool get isEmpty; | 88 bool get isEmpty; |
| 89 |
| 90 Iterable/*<R>*/ map/*<R>*/(/*=R*/ f(E e)); |
| 91 |
| 92 /*=R*/ fold/*<R>*/(/*=R*/ initialValue, |
| 93 /*=R*/ combine(/*=R*/ previousValue, E element)); |
| 89 } | 94 } |
| 90 | 95 |
| 91 abstract class List<E> implements Iterable<E> { | 96 abstract class List<E> implements Iterable<E> { |
| 92 void add(E value); | 97 void add(E value); |
| 93 E operator [](int index); | 98 E operator [](int index); |
| 94 void operator []=(int index, E value); | 99 void operator []=(int index, E value); |
| 95 Iterator<E> get iterator => null; | 100 Iterator<E> get iterator => null; |
| 96 void clear(); | 101 void clear(); |
| 97 } | 102 } |
| 98 | 103 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 116 ''' | 121 ''' |
| 117 library dart.async; | 122 library dart.async; |
| 118 | 123 |
| 119 import 'dart:math'; | 124 import 'dart:math'; |
| 120 | 125 |
| 121 part 'stream.dart'; | 126 part 'stream.dart'; |
| 122 | 127 |
| 123 class Future<T> { | 128 class Future<T> { |
| 124 factory Future.delayed(Duration duration, [T computation()]) => null; | 129 factory Future.delayed(Duration duration, [T computation()]) => null; |
| 125 factory Future.value([value]) => null; | 130 factory Future.value([value]) => null; |
| 126 static Future wait(List<Future> futures) => null; | 131 |
| 132 static Future<List</*<T>*/> wait/*<T>*/( |
| 133 Iterable<Future/*<T>*/> futures) => null; |
| 134 Future/*<R>*/ then/*<R>*/(/*=R*/ onValue(T value)) => null; |
| 127 } | 135 } |
| 128 ''', | 136 ''', |
| 129 const <_MockSdkFile>[ | 137 const <_MockSdkFile>[ |
| 130 const _MockSdkFile( | 138 const _MockSdkFile( |
| 131 '/lib/async/stream.dart', | 139 '/lib/async/stream.dart', |
| 132 r''' | 140 r''' |
| 133 part of dart.async; | 141 part of dart.async; |
| 134 class Stream<T> {} | 142 class Stream<T> {} |
| 135 abstract class StreamTransformer<S, T> {} | 143 abstract class StreamTransformer<S, T> {} |
| 136 ''') | 144 ''') |
| (...skipping 18 matching lines...) Expand all Loading... |
| 155 | 163 |
| 156 abstract class Converter<S, T> implements StreamTransformer {} | 164 abstract class Converter<S, T> implements StreamTransformer {} |
| 157 class JsonDecoder extends Converter<String, Object> {} | 165 class JsonDecoder extends Converter<String, Object> {} |
| 158 '''); | 166 '''); |
| 159 | 167 |
| 160 static const _MockSdkLibrary LIB_MATH = const _MockSdkLibrary( | 168 static const _MockSdkLibrary LIB_MATH = const _MockSdkLibrary( |
| 161 'dart:math', | 169 'dart:math', |
| 162 '/lib/math/math.dart', | 170 '/lib/math/math.dart', |
| 163 ''' | 171 ''' |
| 164 library dart.math; | 172 library dart.math; |
| 173 |
| 165 const double E = 2.718281828459045; | 174 const double E = 2.718281828459045; |
| 166 const double PI = 3.1415926535897932; | 175 const double PI = 3.1415926535897932; |
| 167 const double LN10 = 2.302585092994046; | 176 const double LN10 = 2.302585092994046; |
| 168 num min(num a, num b) => 0; | 177 |
| 169 num max(num a, num b) => 0; | 178 num/*=T*/ min/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b) => null; |
| 179 num/*=T*/ max/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b) => null; |
| 180 |
| 170 external double cos(num x); | 181 external double cos(num x); |
| 171 external double sin(num x); | 182 external double sin(num x); |
| 172 external double sqrt(num x); | 183 external double sqrt(num x); |
| 173 class Random { | 184 class Random { |
| 174 bool nextBool() => true; | 185 bool nextBool() => true; |
| 175 double nextDouble() => 2.0; | 186 double nextDouble() => 2.0; |
| 176 int nextInt() => 1; | 187 int nextInt() => 1; |
| 177 } | 188 } |
| 178 '''); | 189 '''); |
| 179 | 190 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 @override | 372 @override |
| 362 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { | 373 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { |
| 363 if (factory == null) { | 374 if (factory == null) { |
| 364 return super.createCacheFromSourceFactory(factory); | 375 return super.createCacheFromSourceFactory(factory); |
| 365 } | 376 } |
| 366 return new AnalysisCache(<CachePartition>[ | 377 return new AnalysisCache(<CachePartition>[ |
| 367 AnalysisEngine.instance.partitionManager_new.forSdk(sdk) | 378 AnalysisEngine.instance.partitionManager_new.forSdk(sdk) |
| 368 ]); | 379 ]); |
| 369 } | 380 } |
| 370 } | 381 } |
| OLD | NEW |