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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 MockElement(Element enclosingElement) | 430 MockElement(Element enclosingElement) |
431 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, | 431 : super('', ElementKind.FUNCTION, Modifiers.EMPTY, |
432 enclosingElement); | 432 enclosingElement); |
433 | 433 |
434 get node => null; | 434 get node => null; |
435 | 435 |
436 parseNode(_) => null; | 436 parseNode(_) => null; |
437 | 437 |
438 bool get hasNode => false; | 438 bool get hasNode => false; |
439 } | 439 } |
| 440 |
| 441 // TODO(herhut): Disallow warnings and errors during compilation by default. |
| 442 MockCompiler compilerFor(String code, Uri uri, |
| 443 {bool analyzeAll: false, |
| 444 bool analyzeOnly: false, |
| 445 Map<String, String> coreSource, |
| 446 bool disableInlining: true, |
| 447 bool minify: false, |
| 448 bool trustTypeAnnotations: false, |
| 449 bool enableTypeAssertions: false, |
| 450 int expectedErrors, |
| 451 int expectedWarnings, |
| 452 api.CompilerOutputProvider outputProvider}) { |
| 453 MockCompiler compiler = new MockCompiler.internal( |
| 454 analyzeAll: analyzeAll, |
| 455 analyzeOnly: analyzeOnly, |
| 456 coreSource: coreSource, |
| 457 disableInlining: disableInlining, |
| 458 enableMinification: minify, |
| 459 trustTypeAnnotations: trustTypeAnnotations, |
| 460 enableTypeAssertions: enableTypeAssertions, |
| 461 expectedErrors: expectedErrors, |
| 462 expectedWarnings: expectedWarnings, |
| 463 outputProvider: outputProvider); |
| 464 compiler.registerSource(uri, code); |
| 465 compiler.diagnosticHandler = createHandler(compiler, code); |
| 466 return compiler; |
| 467 } |
OLD | NEW |