OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 mock_compiler; | 5 library mock_compiler; |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:collection'; | 9 import 'dart:collection'; |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 registerSource(JavaScriptBackend.DART_JS_HELPER, | 110 registerSource(JavaScriptBackend.DART_JS_HELPER, |
111 buildLibrarySource(DEFAULT_JS_HELPER_LIBRARY)); | 111 buildLibrarySource(DEFAULT_JS_HELPER_LIBRARY)); |
112 registerSource(JavaScriptBackend.DART_FOREIGN_HELPER, | 112 registerSource(JavaScriptBackend.DART_FOREIGN_HELPER, |
113 buildLibrarySource(DEFAULT_FOREIGN_HELPER_LIBRARY)); | 113 buildLibrarySource(DEFAULT_FOREIGN_HELPER_LIBRARY)); |
114 registerSource(JavaScriptBackend.DART_INTERCEPTORS, | 114 registerSource(JavaScriptBackend.DART_INTERCEPTORS, |
115 buildLibrarySource(DEFAULT_INTERCEPTORS_LIBRARY)); | 115 buildLibrarySource(DEFAULT_INTERCEPTORS_LIBRARY)); |
116 registerSource(JavaScriptBackend.DART_ISOLATE_HELPER, | 116 registerSource(JavaScriptBackend.DART_ISOLATE_HELPER, |
117 buildLibrarySource(DEFAULT_ISOLATE_HELPER_LIBRARY)); | 117 buildLibrarySource(DEFAULT_ISOLATE_HELPER_LIBRARY)); |
118 registerSource(Compiler.DART_MIRRORS, | 118 registerSource(Compiler.DART_MIRRORS, |
119 buildLibrarySource(DEFAULT_MIRRORS_LIBRARY)); | 119 buildLibrarySource(DEFAULT_MIRRORS_LIBRARY)); |
| 120 |
| 121 Map<String, String> asyncLibrarySource = <String, String>{}; |
| 122 asyncLibrarySource.addAll(DEFAULT_ASYNC_LIBRARY); |
| 123 if (enableAsyncAwait) { |
| 124 asyncLibrarySource.addAll(ASYNC_AWAIT_LIBRARY); |
| 125 } |
120 registerSource(Compiler.DART_ASYNC, | 126 registerSource(Compiler.DART_ASYNC, |
121 buildLibrarySource(DEFAULT_ASYNC_LIBRARY)); | 127 buildLibrarySource(asyncLibrarySource)); |
122 } | 128 } |
123 | 129 |
124 String get patchVersion { | 130 String get patchVersion { |
125 return testedPatchVersion != null ? testedPatchVersion : super.patchVersion; | 131 return testedPatchVersion != null ? testedPatchVersion : super.patchVersion; |
126 } | 132 } |
127 | 133 |
128 /// Initialize the mock compiler with an empty main library. | 134 /// Initialize the mock compiler with an empty main library. |
129 Future<Uri> init([String mainSource = ""]) { | 135 Future<Uri> init([String mainSource = ""]) { |
130 Uri uri = new Uri(scheme: "mock"); | 136 Uri uri = new Uri(scheme: "mock"); |
131 registerSource(uri, mainSource); | 137 registerSource(uri, mainSource); |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 MockElement(Element enclosingElement) | 410 MockElement(Element enclosingElement) |
405 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, | 411 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, |
406 enclosingElement); | 412 enclosingElement); |
407 | 413 |
408 get node => null; | 414 get node => null; |
409 | 415 |
410 parseNode(_) => null; | 416 parseNode(_) => null; |
411 | 417 |
412 bool get hasNode => false; | 418 bool get hasNode => false; |
413 } | 419 } |
OLD | NEW |