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

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

Issue 10850015: Changed default Uri constructor to Uri.fromComponents(), new default constructor is Uri.fromString(… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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
« no previous file with comments | « dart/runtime/bin/builtin.dart ('k') | dart/tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Test constant folding. 4 // Test constant folding.
5 5
6 #library("compiler_helper"); 6 #library("compiler_helper");
7 7
8 #import("dart:uri"); 8 #import("dart:uri");
9 #import("../../../lib/compiler/implementation/leg.dart", prefix: "leg"); 9 #import("../../../lib/compiler/implementation/leg.dart", prefix: "leg");
10 #import("../../../lib/compiler/implementation/elements/elements.dart", prefix: " lego"); 10 #import("../../../lib/compiler/implementation/elements/elements.dart", prefix: " lego");
11 #import('../../../lib/compiler/implementation/source_file.dart'); 11 #import('../../../lib/compiler/implementation/source_file.dart');
12 #import("../../../lib/compiler/implementation/ssa/ssa.dart", prefix: "ssa"); 12 #import("../../../lib/compiler/implementation/ssa/ssa.dart", prefix: "ssa");
13 #import("parser_helper.dart"); 13 #import("parser_helper.dart");
14 #import("mock_compiler.dart"); 14 #import("mock_compiler.dart");
15 15
16 String compile(String code, [String entry = 'main']) { 16 String compile(String code, [String entry = 'main']) {
17 MockCompiler compiler = new MockCompiler(); 17 MockCompiler compiler = new MockCompiler();
18 compiler.parseScript(code); 18 compiler.parseScript(code);
19 lego.Element element = compiler.mainApp.find(buildSourceString(entry)); 19 lego.Element element = compiler.mainApp.find(buildSourceString(entry));
20 if (element === null) return null; 20 if (element === null) return null;
21 compiler.processQueue(compiler.enqueuer.resolution, element); 21 compiler.processQueue(compiler.enqueuer.resolution, element);
22 leg.WorkItem work = new leg.WorkItem(element, null); 22 leg.WorkItem work = new leg.WorkItem(element, null);
23 String generated = work.run(compiler, compiler.enqueuer.codegen); 23 String generated = work.run(compiler, compiler.enqueuer.codegen);
24 return generated; 24 return generated;
25 } 25 }
26 26
27 String compileAll(String code) { 27 String compileAll(String code) {
28 MockCompiler compiler = new MockCompiler(); 28 MockCompiler compiler = new MockCompiler();
29 Uri uri = new Uri(scheme: 'source'); 29 Uri uri = new Uri.fromComponents(scheme: 'source');
30 compiler.sourceFiles[uri.toString()] = new SourceFile(uri.toString(), code); 30 compiler.sourceFiles[uri.toString()] = new SourceFile(uri.toString(), code);
31 compiler.runCompiler(uri); 31 compiler.runCompiler(uri);
32 return compiler.assembledCode; 32 return compiler.assembledCode;
33 } 33 }
34 34
35 String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*"; 35 String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*";
36 36
37 String getIntTypeCheck(String variable) { 37 String getIntTypeCheck(String variable) {
38 return "\\($variable !== \\($variable \\| 0\\)\\)"; 38 return "\\($variable !== \\($variable \\| 0\\)\\)";
39 } 39 }
(...skipping 14 matching lines...) Expand all
54 String generated = compile(code, entry); 54 String generated = compile(code, entry);
55 Expect.isTrue(regexp.hasMatch(generated), 55 Expect.isTrue(regexp.hasMatch(generated),
56 '"$generated" does not match /$regexp/'); 56 '"$generated" does not match /$regexp/');
57 } 57 }
58 58
59 void compileAndDoNotMatch(String code, String entry, RegExp regexp) { 59 void compileAndDoNotMatch(String code, String entry, RegExp regexp) {
60 String generated = compile(code, entry); 60 String generated = compile(code, entry);
61 Expect.isFalse(regexp.hasMatch(generated), 61 Expect.isFalse(regexp.hasMatch(generated),
62 '"$generated" has a match in /$regexp/'); 62 '"$generated" has a match in /$regexp/');
63 } 63 }
OLDNEW
« no previous file with comments | « dart/runtime/bin/builtin.dart ('k') | dart/tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698