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

Side by Side Diff: dart/tests/compiler/dart2js/deferred_load_graph_segmentation_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
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 // Test of the graph segmentation algorithm used by deferred loading 5 // Test of the graph segmentation algorithm used by deferred loading
6 // to determine which elements can be deferred and which libraries 6 // to determine which elements can be deferred and which libraries
7 // much be included in the initial download (loaded eagerly). 7 // much be included in the initial download (loaded eagerly).
8 8
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import 'dart:async' show Future; 10 import 'memory_source_file_helper.dart';
11 import 'dart:uri' show Uri;
12 import 'dart:io';
13
14 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart'
15 show Compiler;
16 11
17 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' 12 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'
18 as dart2js; 13 as dart2js;
19 14
20 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'
21 show getCurrentDirectory, nativeToUriPath;
22
23 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'
24 show SourceFile;
25
26 import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider. dart'
27 show FormattingDiagnosticHandler,
28 SourceFileProvider;
29
30 class MemorySourceFileProvider extends SourceFileProvider {
31 Future<String> readStringFromUri(Uri resourceUri) {
32 if (resourceUri.scheme != 'memory') {
33 return super.readStringFromUri(resourceUri);
34 }
35 String source = MEMORY_SOURCE_FILES[resourceUri.path];
36 // TODO(ahe): Return new Future.immediateError(...) ?
37 if (source == null) throw 'No such file $resourceUri';
38 String resourceName = '$resourceUri';
39 this.sourceFiles[resourceName] = new SourceFile(resourceName, source);
40 return new Future.immediate(source);
41 }
42 }
43
44 void main() { 15 void main() {
45 Uri cwd = getCurrentDirectory(); 16 Uri cwd = getCurrentDirectory();
46 Uri script = cwd.resolve(nativeToUriPath(new Options().script)); 17 Uri script = cwd.resolve(nativeToUriPath(new Options().script));
47 Uri libraryRoot = script.resolve('../../../sdk/'); 18 Uri libraryRoot = script.resolve('../../../sdk/');
48 Uri packageRoot = script.resolve('./packages/'); 19 Uri packageRoot = script.resolve('./packages/');
49 20
21 MemorySourceFileProvider.MEMORY_SOURCE_FILES = MEMORY_SOURCE_FILES;
50 var provider = new MemorySourceFileProvider(); 22 var provider = new MemorySourceFileProvider();
51 var handler = new FormattingDiagnosticHandler(provider); 23 var handler = new FormattingDiagnosticHandler(provider);
52 24
53 Compiler compiler = new Compiler(provider.readStringFromUri, 25 Compiler compiler = new Compiler(provider.readStringFromUri,
54 (name, extension) => null, 26 (name, extension) => null,
55 handler.diagnosticHandler, 27 handler.diagnosticHandler,
56 libraryRoot, 28 libraryRoot,
57 packageRoot, 29 packageRoot,
58 ['--analyze-only']); 30 ['--analyze-only']);
59 compiler.run(new Uri('memory:main.dart')); 31 compiler.run(new Uri('memory:main.dart'));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 class MyClass { 70 class MyClass {
99 const MyClass(); 71 const MyClass();
100 72
101 foo(x) { 73 foo(x) {
102 new Expando(); 74 new Expando();
103 return (x - 3) ~/ 2; 75 return (x - 3) ~/ 2;
104 } 76 }
105 } 77 }
106 """, 78 """,
107 }; 79 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698