| 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 testing.mock_sdk; | 5 library testing.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/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/sdk.dart'; | 10 import 'package:analyzer/src/generated/sdk.dart'; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 class Symbol {} | 26 class Symbol {} |
| 27 class Type {} | 27 class Type {} |
| 28 | 28 |
| 29 class String extends Object {} | 29 class String extends Object {} |
| 30 class bool extends Object {} | 30 class bool extends Object {} |
| 31 abstract class num extends Object { | 31 abstract class num extends Object { |
| 32 num operator +(num other); | 32 num operator +(num other); |
| 33 num operator -(num other); | 33 num operator -(num other); |
| 34 num operator *(num other); | 34 num operator *(num other); |
| 35 num operator /(num other); | 35 num operator /(num other); |
| 36 int toInt(); |
| 36 } | 37 } |
| 37 abstract class int extends num { | 38 abstract class int extends num { |
| 38 int operator -(); | 39 int operator -(); |
| 39 } | 40 } |
| 40 class double extends num {} | 41 class double extends num {} |
| 41 class DateTime extends Object {} | 42 class DateTime extends Object {} |
| 42 class Null extends Object {} | 43 class Null extends Object {} |
| 43 | 44 |
| 44 class Deprecated extends Object { | 45 class Deprecated extends Object { |
| 45 final String expires; | 46 final String expires; |
| 46 const Deprecated(this.expires); | 47 const Deprecated(this.expires); |
| 47 } | 48 } |
| 48 const Object deprecated = const Deprecated("next release"); | 49 const Object deprecated = const Deprecated("next release"); |
| 49 | 50 |
| 50 abstract class List<E> extends Object { | 51 abstract class List<E> extends Object { |
| 51 void add(E value); | 52 void add(E value); |
| 52 E operator [](int index); | 53 E operator [](int index); |
| 53 void operator []=(int index, E value); | 54 void operator []=(int index, E value); |
| 54 } | 55 } |
| 55 class Map<K, V> extends Object {} | 56 class Map<K, V> extends Object {} |
| 56 | 57 |
| 57 void print(Object object) {} | 58 void print(Object object) {} |
| 58 ''', | 59 ''', |
| 59 | 60 |
| 60 "/lib/html/dartium/html_dartium.dart": ''' | 61 "/lib/html/dartium/html_dartium.dart": ''' |
| 61 library dart.html; | 62 library dart.html; |
| 62 class HtmlElement {} | 63 class HtmlElement {} |
| 63 ''', | 64 ''', |
| 64 | 65 |
| 66 "/lib/async/async.dart": ''' |
| 67 library dart.async; |
| 68 class Future { |
| 69 static Future wait(List<Future> futures) => null; |
| 70 } |
| 71 ''', |
| 72 |
| 65 "/lib/math/math.dart": ''' | 73 "/lib/math/math.dart": ''' |
| 66 library dart.math; | 74 library dart.math; |
| 67 const double E = 2.718281828459045; | 75 const double E = 2.718281828459045; |
| 68 const double PI = 3.1415926535897932; | 76 const double PI = 3.1415926535897932; |
| 69 ''' | 77 ''' |
| 70 }; | 78 }; |
| 71 | 79 |
| 72 pathToContent.forEach((String path, String content) { | 80 pathToContent.forEach((String path, String content) { |
| 73 provider.newFile(path, content); | 81 provider.newFile(path, content); |
| 74 }); | 82 }); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // return null. | 115 // return null. |
| 108 return null; | 116 return null; |
| 109 } | 117 } |
| 110 | 118 |
| 111 // Not used. | 119 // Not used. |
| 112 @override | 120 @override |
| 113 Source mapDartUri(String dartUri) { | 121 Source mapDartUri(String dartUri) { |
| 114 const Map<String, String> uriToPath = const { | 122 const Map<String, String> uriToPath = const { |
| 115 "dart:core": "/lib/core/core.dart", | 123 "dart:core": "/lib/core/core.dart", |
| 116 "dart:html": "/lib/html/dartium/html_dartium.dart", | 124 "dart:html": "/lib/html/dartium/html_dartium.dart", |
| 125 "dart:async": "/lib/async/async.dart", |
| 117 "dart:math": "/lib/math/math.dart" | 126 "dart:math": "/lib/math/math.dart" |
| 118 }; | 127 }; |
| 119 | 128 |
| 120 String path = uriToPath[dartUri]; | 129 String path = uriToPath[dartUri]; |
| 121 if (path != null) { | 130 if (path != null) { |
| 122 resource.File file = provider.getResource(path); | 131 resource.File file = provider.getResource(path); |
| 123 return file.createSource(UriKind.DART_URI); | 132 return file.createSource(UriKind.DART_URI); |
| 124 } | 133 } |
| 125 | 134 |
| 126 // If we reach here then we tried to use a dartUri that's not in the | 135 // If we reach here then we tried to use a dartUri that's not in the |
| 127 // table above. | 136 // table above. |
| 128 throw unimplemented; | 137 throw unimplemented; |
| 129 } | 138 } |
| 130 } | 139 } |
| OLD | NEW |