| 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 | 7 |
| 8 import '../../../sdk/lib/_internal/compiler/compiler.dart' | 8 import '../../../sdk/lib/_internal/compiler/compiler.dart' |
| 9 show Diagnostic; | 9 show Diagnostic; |
| 10 | 10 |
| (...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 compiler.run(Uri.parse('memory:main.dart')); | 40 compiler.run(Uri.parse('memory:main.dart')).then((_) { |
| 41 Expect.isTrue(compiler.compilationFailed); | 41 Expect.isTrue(compiler.compilationFailed); |
| 42 Expect.equals(5, errorCount); | 42 Expect.equals(5, errorCount); |
| 43 Expect.equals(1, warningCount); | 43 Expect.equals(1, warningCount); |
| 44 }); |
| 44 } | 45 } |
| 45 | 46 |
| 46 const Map MEMORY_SOURCE_FILES = const { | 47 const Map MEMORY_SOURCE_FILES = const { |
| 47 'main.dart': """ | 48 'main.dart': """ |
| 48 main() { | 49 main() { |
| 49 for (var x, y in []) { | 50 for (var x, y in []) { |
| 50 } | 51 } |
| 51 | 52 |
| 52 for (var x = 10 in []) { | 53 for (var x = 10 in []) { |
| 53 } | 54 } |
| 54 | 55 |
| 55 for (x.y in []) { // Also causes a warning "x unresolved". | 56 for (x.y in []) { // Also causes a warning "x unresolved". |
| 56 } | 57 } |
| 57 | 58 |
| 58 for ((){}() in []) { | 59 for ((){}() in []) { |
| 59 } | 60 } |
| 60 | 61 |
| 61 for (1 in []) { | 62 for (1 in []) { |
| 62 } | 63 } |
| 63 } | 64 } |
| 64 """ | 65 """ |
| 65 }; | 66 }; |
| OLD | NEW |