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 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'dart:uri'; | 8 import 'dart:uri'; |
9 | 9 |
10 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; | 10 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; |
11 import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t'; | 11 import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t'; |
12 import '../../../sdk/lib/_internal/compiler/implementation/resolution/resolution
.dart'; | 12 import '../../../sdk/lib/_internal/compiler/implementation/resolution/resolution
.dart'; |
13 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; | 13 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; |
14 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; | 14 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; |
15 import '../../../sdk/lib/_internal/compiler/implementation/util/util.dart'; | 15 import '../../../sdk/lib/_internal/compiler/implementation/util/util.dart'; |
16 import 'parser_helper.dart'; | 16 import 'parser_helper.dart'; |
17 | 17 |
18 import '../../../sdk/lib/_internal/compiler/implementation/elements/modelx.dart' | 18 import '../../../sdk/lib/_internal/compiler/implementation/elements/modelx.dart' |
19 show ElementX, | 19 show ElementX, |
20 LibraryElementX, | 20 LibraryElementX, |
21 ErroneousElementX; | 21 ErroneousElementX; |
22 | 22 |
23 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 23 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
24 hide TreeElementMapping; | 24 hide TreeElementMapping; |
25 | 25 |
26 import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart'; | 26 import '../../../sdk/lib/_internal/compiler/implementation/dart_types.dart'; |
27 | 27 |
| 28 import '../../../sdk/lib/_internal/compiler/implementation/deferred_load.dart' |
| 29 show DeferredLoadTask; |
| 30 |
| 31 |
28 class WarningMessage { | 32 class WarningMessage { |
29 Node node; | 33 Node node; |
30 Message message; | 34 Message message; |
31 WarningMessage(this.node, this.message); | 35 WarningMessage(this.node, this.message); |
32 | 36 |
33 toString() => message.toString(); | 37 toString() => message.toString(); |
34 } | 38 } |
35 | 39 |
36 const String DEFAULT_HELPERLIB = r''' | 40 const String DEFAULT_HELPERLIB = r''' |
37 $throw(x) { return x; } | 41 $throw(x) { return x; } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 initializeSpecialClasses(); | 164 initializeSpecialClasses(); |
161 // We need to make sure the Object class is resolved. When registering a | 165 // We need to make sure the Object class is resolved. When registering a |
162 // dynamic invocation the ArgumentTypesRegistry eventually iterates over | 166 // dynamic invocation the ArgumentTypesRegistry eventually iterates over |
163 // the interfaces of the Object class which would be 'null' if the class | 167 // the interfaces of the Object class which would be 'null' if the class |
164 // wasn't resolved. | 168 // wasn't resolved. |
165 objectClass.ensureResolved(this); | 169 objectClass.ensureResolved(this); |
166 | 170 |
167 // Our unit tests check code generation output that is affected by | 171 // Our unit tests check code generation output that is affected by |
168 // inlining support. | 172 // inlining support. |
169 disableInlining = true; | 173 disableInlining = true; |
| 174 |
| 175 deferredLoadTask = new MockDeferredLoadTask(this); |
170 } | 176 } |
171 | 177 |
172 /** | 178 /** |
173 * Registers the [source] with [uri] making it possible load [source] as a | 179 * Registers the [source] with [uri] making it possible load [source] as a |
174 * library. | 180 * library. |
175 */ | 181 */ |
176 void registerSource(Uri uri, String source) { | 182 void registerSource(Uri uri, String source) { |
177 sourceFiles[uri.toString()] = new MockFile(source); | 183 sourceFiles[uri.toString()] = new MockFile(source); |
178 } | 184 } |
179 | 185 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 operator []=(Node node, Element element) { | 341 operator []=(Node node, Element element) { |
336 map[node] = element; | 342 map[node] = element; |
337 } | 343 } |
338 | 344 |
339 operator [](Node node) => map[node]; | 345 operator [](Node node) => map[node]; |
340 | 346 |
341 void remove(Node node) { | 347 void remove(Node node) { |
342 map.remove(node); | 348 map.remove(node); |
343 } | 349 } |
344 } | 350 } |
| 351 |
| 352 class MockDeferredLoadTask extends DeferredLoadTask { |
| 353 MockDeferredLoadTask(Compiler compiler) : super(compiler); |
| 354 |
| 355 void registerMainApp(LibraryElement mainApp) { |
| 356 // Do nothing. |
| 357 } |
| 358 } |
OLD | NEW |