Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Side by Side Diff: dart/tests/compiler/dart2js/bad_loop_test.dart

Issue 13866010: Correctly compile unresolved for-in loops. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Additional problems found during testing. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:expect/expect.dart';
6 import 'memory_source_file_helper.dart';
7
8 import '../../../sdk/lib/_internal/compiler/compiler.dart'
9 show Diagnostic;
10
11 main() {
12 Uri cwd = getCurrentDirectory();
13 Uri script = cwd.resolve(nativeToUriPath(new Options().script));
14 Uri libraryRoot = script.resolve('../../../sdk/');
15 Uri packageRoot = script.resolve('./packages/');
16
17 MemorySourceFileProvider.MEMORY_SOURCE_FILES = MEMORY_SOURCE_FILES;
18 var provider = new MemorySourceFileProvider();
19 int warningCount = 0;
20 int errorCount = 0;
21 void diagnosticHandler(Uri uri, int begin, int end,
22 String message, Diagnostic kind) {
23 if (kind == Diagnostic.VERBOSE_INFO) {
24 return;
25 }
26 if (kind == Diagnostic.ERROR) {
27 errorCount++;
28 } else if (kind == Diagnostic.WARNING) {
29 warningCount++;
30 } else {
31 throw 'unexpected diagnostic $kind: $message';
32 }
33 }
34
35 Compiler compiler = new Compiler(provider.readStringFromUri,
36 (name, extension) => null,
37 diagnosticHandler,
38 libraryRoot,
39 packageRoot,
40 ['--analyze-only']);
41 compiler.run(new Uri('memory:main.dart'));
42 Expect.isTrue(compiler.compilationFailed);
43 Expect.equals(5, errorCount);
44 Expect.equals(1, warningCount);
45 }
46
47 const Map MEMORY_SOURCE_FILES = const {
48 'main.dart': """
49 main() {
50 for (var x, y in []) {
51 }
52
53 for (var x = 10 in []) {
54 }
55
56 for (x.y in []) { // Also causes a warning "x unresolved".
57 }
58
59 for ((){}() in []) {
60 }
61
62 for (1 in []) {
63 }
64 }
65 """
66 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698