| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
| 6 import 'memory_source_file_helper.dart'; | 6 import 'memory_source_file_helper.dart'; |
| 7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
| 8 | 8 |
| 9 import '../../../sdk/lib/_internal/compiler/compiler.dart' | 9 import '../../../sdk/lib/_internal/compiler/compiler.dart' |
| 10 show Diagnostic; | 10 show Diagnostic; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 throw 'unexpected diagnostic $kind: $message'; | 30 throw 'unexpected diagnostic $kind: $message'; |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 | 33 |
| 34 Compiler compiler = new Compiler(provider.readStringFromUri, | 34 Compiler compiler = new Compiler(provider.readStringFromUri, |
| 35 (name, extension) => null, | 35 (name, extension) => null, |
| 36 diagnosticHandler, | 36 diagnosticHandler, |
| 37 libraryRoot, | 37 libraryRoot, |
| 38 packageRoot, | 38 packageRoot, |
| 39 ['--analyze-only']); | 39 ['--analyze-only']); |
| 40 asyncStart(); | 40 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { |
| 41 compiler.run(Uri.parse('memory:main.dart')).then((_) { | |
| 42 Expect.isTrue(compiler.compilationFailed); | 41 Expect.isTrue(compiler.compilationFailed); |
| 43 Expect.equals(5, errorCount); | 42 Expect.equals(5, errorCount); |
| 44 Expect.equals(1, warningCount); | 43 Expect.equals(1, warningCount); |
| 45 }).whenComplete(() => asyncEnd()); | 44 })); |
| 46 } | 45 } |
| 47 | 46 |
| 48 const Map MEMORY_SOURCE_FILES = const { | 47 const Map MEMORY_SOURCE_FILES = const { |
| 49 'main.dart': """ | 48 'main.dart': """ |
| 50 main() { | 49 main() { |
| 51 for (var x, y in []) { | 50 for (var x, y in []) { |
| 52 } | 51 } |
| 53 | 52 |
| 54 for (var x = 10 in []) { | 53 for (var x = 10 in []) { |
| 55 } | 54 } |
| 56 | 55 |
| 57 for (x.y in []) { // Also causes a warning "x unresolved". | 56 for (x.y in []) { // Also causes a warning "x unresolved". |
| 58 } | 57 } |
| 59 | 58 |
| 60 for ((){}() in []) { | 59 for ((){}() in []) { |
| 61 } | 60 } |
| 62 | 61 |
| 63 for (1 in []) { | 62 for (1 in []) { |
| 64 } | 63 } |
| 65 } | 64 } |
| 66 """ | 65 """ |
| 67 }; | 66 }; |
| OLD | NEW |