| 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 const DEFAULT_PLATFORM_CONFIG = """ | 9 const DEFAULT_PLATFORM_CONFIG = """ |
| 10 [libraries] | 10 [libraries] |
| 11 core:core/core.dart | 11 core:core/core.dart |
| 12 async:async/async.dart | 12 async:async/async.dart |
| 13 _js_helper:_internal/js_runtime/lib/js_helper.dart | 13 _js_helper:_internal/js_runtime/lib/js_helper.dart |
| 14 _interceptors:_internal/js_runtime/lib/interceptors.dart | 14 _interceptors:_internal/js_runtime/lib/interceptors.dart |
| 15 _internal:internal/internal.dart |
| 15 _isolate_helper:_internal/js_runtime/lib/isolate_helper.dart | 16 _isolate_helper:_internal/js_runtime/lib/isolate_helper.dart |
| 16 """; | 17 """; |
| 17 | 18 |
| 18 String buildLibrarySource(Map<String, String> elementMap, | 19 String buildLibrarySource(Map<String, String> elementMap, |
| 19 [Map<String, String> additionalElementMap = const <String, String>{}]) { | 20 [Map<String, String> additionalElementMap = const <String, String>{}]) { |
| 20 Map<String, String> map = new Map<String, String>.from(elementMap); | 21 Map<String, String> map = new Map<String, String>.from(elementMap); |
| 21 if (additionalElementMap != null) { | 22 if (additionalElementMap != null) { |
| 22 map.addAll(additionalElementMap); | 23 map.addAll(additionalElementMap); |
| 23 } | 24 } |
| 24 StringBuffer sb = new StringBuffer(); | 25 StringBuffer sb = new StringBuffer(); |
| 25 map.values.forEach((String element) { | 26 map.values.forEach((String element) { |
| 26 sb.write('$element\n'); | 27 sb.write('$element\n'); |
| 27 }); | 28 }); |
| 28 return sb.toString(); | 29 return sb.toString(); |
| 29 } | 30 } |
| 30 | 31 |
| 31 const Map<String, String> DEFAULT_CORE_LIBRARY = const <String, String>{ | 32 const Map<String, String> DEFAULT_CORE_LIBRARY = const <String, String>{ |
| 33 '<imports>': ''' |
| 34 import 'dart:_internal' as internal; |
| 35 ''', |
| 32 'bool': 'class bool {}', | 36 'bool': 'class bool {}', |
| 33 'Comparator': 'abstract class Comparator<T> {}', | 37 'Comparator': 'abstract class Comparator<T> {}', |
| 34 'DateTime': r''' | 38 'DateTime': r''' |
| 35 class DateTime { | 39 class DateTime { |
| 36 DateTime(year); | 40 DateTime(year); |
| 37 DateTime.utc(year); | 41 DateTime.utc(year); |
| 38 }''', | 42 }''', |
| 39 'Deprecated': r''' | 43 'Deprecated': r''' |
| 40 class Deprecated extends Object { | 44 class Deprecated extends Object { |
| 41 final String expires; | 45 final String expires; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 class Object { | 95 class Object { |
| 92 const Object(); | 96 const Object(); |
| 93 operator ==(other) { return true; } | 97 operator ==(other) { return true; } |
| 94 get hashCode => throw "Object.hashCode not implemented."; | 98 get hashCode => throw "Object.hashCode not implemented."; |
| 95 String toString() { return null; } | 99 String toString() { return null; } |
| 96 noSuchMethod(im) { throw im; } | 100 noSuchMethod(im) { throw im; } |
| 97 }''', | 101 }''', |
| 98 'Resource': 'class Resource {}', | 102 'Resource': 'class Resource {}', |
| 99 'StackTrace': 'abstract class StackTrace {}', | 103 'StackTrace': 'abstract class StackTrace {}', |
| 100 'String': 'class String implements Pattern {}', | 104 'String': 'class String implements Pattern {}', |
| 101 'Symbol': 'class Symbol { final _name; const Symbol(this._name); }', | 105 'Symbol': ''' |
| 106 abstract class Symbol { |
| 107 const factory Symbol(String name) = internal.Symbol; |
| 108 } |
| 109 ''', |
| 102 'Type': 'class Type {}', | 110 'Type': 'class Type {}', |
| 103 'Pattern': 'abstract class Pattern {}', | 111 'Pattern': 'abstract class Pattern {}', |
| 104 '_genericNoSuchMethod': '_genericNoSuchMethod(a,b,c,d,e) {}', | 112 '_genericNoSuchMethod': '_genericNoSuchMethod(a,b,c,d,e) {}', |
| 105 '_unresolvedConstructorError': '_unresolvedConstructorError(a,b,c,d,e) {}', | 113 '_unresolvedConstructorError': '_unresolvedConstructorError(a,b,c,d,e) {}', |
| 106 '_malformedTypeError': '_malformedTypeError(message) {}', | 114 '_malformedTypeError': '_malformedTypeError(message) {}', |
| 107 }; | 115 }; |
| 108 | 116 |
| 117 const Map<String, String> DEFAULT_INTERNAL_LIBRARY = const <String, String>{ |
| 118 '<imports>': ''' |
| 119 import 'dart:core' as core; |
| 120 ''', |
| 121 'Symbol': ''' |
| 122 class Symbol implements core.Symbol { |
| 123 final core.String _name; |
| 124 |
| 125 const Symbol(this._name); |
| 126 Symbol.validated(this._name); |
| 127 } |
| 128 ''', |
| 129 }; |
| 130 |
| 109 const String DEFAULT_PATCH_CORE_SOURCE = r''' | 131 const String DEFAULT_PATCH_CORE_SOURCE = r''' |
| 110 import 'dart:_js_helper'; | 132 import 'dart:_js_helper'; |
| 111 import 'dart:_interceptors'; | 133 import 'dart:_interceptors'; |
| 112 import 'dart:_isolate_helper'; | 134 import 'dart:_isolate_helper'; |
| 113 import 'dart:async'; | 135 import 'dart:async'; |
| 114 | 136 |
| 115 @patch | 137 @patch |
| 116 class LinkedHashMap<K, V> { | 138 class LinkedHashMap<K, V> { |
| 117 factory LinkedHashMap._empty() => null; | 139 factory LinkedHashMap._empty() => null; |
| 118 factory LinkedHashMap._literal(elements) => null; | 140 factory LinkedHashMap._literal(elements) => null; |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 484 |
| 463 const LookupMap(this._entries, [this._nestedMaps = const []]) | 485 const LookupMap(this._entries, [this._nestedMaps = const []]) |
| 464 : _key = null, _value = null; | 486 : _key = null, _value = null; |
| 465 | 487 |
| 466 const LookupMap.pair(this._key, this._value) | 488 const LookupMap.pair(this._key, this._value) |
| 467 : _entries = const [], _nestedMaps = const []; | 489 : _entries = const [], _nestedMaps = const []; |
| 468 V operator[](K k) => null; | 490 V operator[](K k) => null; |
| 469 }''', | 491 }''', |
| 470 '_version': 'const _version = "0.0.1+1";', | 492 '_version': 'const _version = "0.0.1+1";', |
| 471 }; | 493 }; |
| OLD | NEW |