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 for creating mock versions of platform and internal libraries. | 5 // Library for creating mock versions of platform and internal libraries. |
6 | 6 |
7 library mock_libraries; | 7 library mock_libraries; |
8 | 8 |
9 String buildLibrarySource( | 9 String buildLibrarySource( |
10 Map<String, String> elementMap, | 10 Map<String, String> elementMap, |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 'TypeImpl': 'class TypeImpl {}', | 229 'TypeImpl': 'class TypeImpl {}', |
230 'TypeVariable': 'class TypeVariable {}', | 230 'TypeVariable': 'class TypeVariable {}', |
231 'unwrapException': 'unwrapException(e) {}', | 231 'unwrapException': 'unwrapException(e) {}', |
232 'voidTypeCheck': 'voidTypeCheck(value) {}', | 232 'voidTypeCheck': 'voidTypeCheck(value) {}', |
233 'wrapException': 'wrapException(x) { return x; }', | 233 'wrapException': 'wrapException(x) { return x; }', |
234 'badMain': 'badMain() { throw "bad main"; }', | 234 'badMain': 'badMain() { throw "bad main"; }', |
235 'missingMain': 'missingMain() { throw "missing main"; }', | 235 'missingMain': 'missingMain() { throw "missing main"; }', |
236 'mainHasTooManyParameters': | 236 'mainHasTooManyParameters': |
237 'mainHasTooManyParameters() ' | 237 'mainHasTooManyParameters() ' |
238 '{ throw "main has too many parameters"; }', | 238 '{ throw "main has too many parameters"; }', |
239 '_wrapJsFunctionForAsync': '_wrapJsFunctionForAsync(f) {}', | |
240 }; | 239 }; |
241 | 240 |
242 const Map<String, String> DEFAULT_FOREIGN_HELPER_LIBRARY | 241 const Map<String, String> DEFAULT_FOREIGN_HELPER_LIBRARY |
243 = const <String, String>{ | 242 = const <String, String>{ |
244 'JS': r''' | 243 'JS': r''' |
245 dynamic JS(String typeDescription, String codeTemplate, | 244 dynamic JS(String typeDescription, String codeTemplate, |
246 [var arg0, var arg1, var arg2, var arg3, var arg4, var arg5, var arg6, | 245 [var arg0, var arg1, var arg2, var arg3, var arg4, var arg5, var arg6, |
247 var arg7, var arg8, var arg9, var arg10, var arg11]) {}''', | 246 var arg7, var arg8, var arg9, var arg10, var arg11]) {}''', |
248 }; | 247 }; |
249 | 248 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 ''' | 379 ''' |
381 class Future<T> { | 380 class Future<T> { |
382 Future.value([value]); | 381 Future.value([value]); |
383 } | 382 } |
384 ''', | 383 ''', |
385 'Stream': 'class Stream<T> {}', | 384 'Stream': 'class Stream<T> {}', |
386 'Completer': 'class Completer<T> {}', | 385 'Completer': 'class Completer<T> {}', |
387 'StreamIterator': 'class StreamIterator<T> {}', | 386 'StreamIterator': 'class StreamIterator<T> {}', |
388 }; | 387 }; |
389 | 388 |
| 389 /// These members are only needed when async/await is used. |
| 390 const Map<String, String> ASYNC_AWAIT_LIBRARY = const <String, String>{ |
| 391 '_wrapJsFunctionForAsync': '_wrapJsFunctionForAsync(f) {}', |
| 392 '_asyncHelper': '_asyncHelper(o, f, c) {}', |
| 393 }; |
| 394 |
390 const Map<String, String> DEFAULT_MIRRORS_LIBRARY = const <String, String>{ | 395 const Map<String, String> DEFAULT_MIRRORS_LIBRARY = const <String, String>{ |
391 'Comment': 'class Comment {}', | 396 'Comment': 'class Comment {}', |
392 'MirrorSystem': 'class MirrorSystem {}', | 397 'MirrorSystem': 'class MirrorSystem {}', |
393 'MirrorsUsed': 'class MirrorsUsed {}', | 398 'MirrorsUsed': 'class MirrorsUsed {}', |
394 }; | 399 }; |
OLD | NEW |