OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:compiler/compiler.dart' as api; | 10 import 'package:compiler/compiler.dart' as api; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 static Future create(f(MockCompiler compiler)) { | 283 static Future create(f(MockCompiler compiler)) { |
284 MockCompiler compiler = new MockCompiler.internal(); | 284 MockCompiler compiler = new MockCompiler.internal(); |
285 return compiler.init().then((_) => f(compiler)); | 285 return compiler.init().then((_) => f(compiler)); |
286 } | 286 } |
287 } | 287 } |
288 | 288 |
289 class MockResolvedUriTranslator implements ResolvedUriTranslator { | 289 class MockResolvedUriTranslator implements ResolvedUriTranslator { |
290 static final _emptySet = new Set(); | 290 static final _emptySet = new Set(); |
291 | 291 |
292 Uri translate(LibraryElement importingLibrary, Uri resolvedUri, | 292 Uri translate(LibraryElement importingLibrary, Uri resolvedUri, |
293 [Spannable spannable]) => | 293 Spannable spannable) => |
294 resolvedUri; | 294 resolvedUri; |
295 Set<Uri> get disallowedLibraryUris => _emptySet; | 295 Set<Uri> get disallowedLibraryUris => _emptySet; |
296 bool get mockableLibraryUsed => false; | 296 bool get mockableLibraryUsed => false; |
297 Map<String, Uri> get sdkLibraries => const <String, Uri>{}; | 297 Map<String, Uri> get sdkLibraries => const <String, Uri>{}; |
298 } | 298 } |
299 | 299 |
300 class CollectingTreeElements extends TreeElementMapping { | 300 class CollectingTreeElements extends TreeElementMapping { |
301 final Map<Node, Element> map = new LinkedHashMap<Node, Element>(); | 301 final Map<Node, Element> map = new LinkedHashMap<Node, Element>(); |
302 | 302 |
303 CollectingTreeElements(Element currentElement) : super(currentElement); | 303 CollectingTreeElements(Element currentElement) : super(currentElement); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 trustTypeAnnotations: trustTypeAnnotations, | 390 trustTypeAnnotations: trustTypeAnnotations, |
391 enableTypeAssertions: enableTypeAssertions, | 391 enableTypeAssertions: enableTypeAssertions, |
392 enableUserAssertions: enableUserAssertions, | 392 enableUserAssertions: enableUserAssertions, |
393 expectedErrors: expectedErrors, | 393 expectedErrors: expectedErrors, |
394 expectedWarnings: expectedWarnings, | 394 expectedWarnings: expectedWarnings, |
395 outputProvider: outputProvider); | 395 outputProvider: outputProvider); |
396 compiler.registerSource(uri, code); | 396 compiler.registerSource(uri, code); |
397 compiler.diagnosticHandler = createHandler(compiler, code); | 397 compiler.diagnosticHandler = createHandler(compiler, code); |
398 return compiler; | 398 return compiler; |
399 } | 399 } |
OLD | NEW |