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

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

Issue 10876036: Extend testing of metadata. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed missing import Created 8 years, 3 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) 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
10 #import("../../../lib/compiler/implementation/elements/elements.dart", prefix: " lego");
11 #import("../../../lib/compiler/implementation/js_backend/js_backend.dart", prefi x: "js");
9 #import("../../../lib/compiler/implementation/leg.dart", prefix: "leg"); 12 #import("../../../lib/compiler/implementation/leg.dart", prefix: "leg");
10 #import("../../../lib/compiler/implementation/js_backend/js_backend.dart", prefi x: "js"); 13 #import("../../../lib/compiler/implementation/ssa/ssa.dart", prefix: "ssa");
11 #import("../../../lib/compiler/implementation/elements/elements.dart", prefix: " lego"); 14 #import("../../../lib/compiler/implementation/util/util.dart");
12 #import('../../../lib/compiler/implementation/source_file.dart'); 15 #import('../../../lib/compiler/implementation/source_file.dart');
13 #import("../../../lib/compiler/implementation/ssa/ssa.dart", prefix: "ssa"); 16
17 #import("mock_compiler.dart");
14 #import("parser_helper.dart"); 18 #import("parser_helper.dart");
15 #import("mock_compiler.dart");
16 19
17 String compile(String code, [String entry = 'main']) { 20 String compile(String code, [String entry = 'main']) {
18 MockCompiler compiler = new MockCompiler(); 21 MockCompiler compiler = new MockCompiler();
19 compiler.parseScript(code); 22 compiler.parseScript(code);
20 lego.Element element = compiler.mainApp.find(buildSourceString(entry)); 23 lego.Element element = compiler.mainApp.find(buildSourceString(entry));
21 if (element === null) return null; 24 if (element === null) return null;
22 compiler.processQueue(compiler.enqueuer.resolution, element); 25 compiler.processQueue(compiler.enqueuer.resolution, element);
23 var context = new js.JavaScriptItemCompilationContext(); 26 var context = new js.JavaScriptItemCompilationContext();
24 leg.WorkItem work = new leg.WorkItem(element, null, context); 27 leg.WorkItem work = new leg.WorkItem(element, null, context);
25 work.run(compiler, compiler.enqueuer.codegen); 28 work.run(compiler, compiler.enqueuer.codegen);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 String generated = compile(code, entry); 82 String generated = compile(code, entry);
80 Expect.isTrue(regexp.hasMatch(generated), 83 Expect.isTrue(regexp.hasMatch(generated),
81 '"$generated" does not match /$regexp/'); 84 '"$generated" does not match /$regexp/');
82 } 85 }
83 86
84 void compileAndDoNotMatch(String code, String entry, RegExp regexp) { 87 void compileAndDoNotMatch(String code, String entry, RegExp regexp) {
85 String generated = compile(code, entry); 88 String generated = compile(code, entry);
86 Expect.isFalse(regexp.hasMatch(generated), 89 Expect.isFalse(regexp.hasMatch(generated),
87 '"$generated" has a match in /$regexp/'); 90 '"$generated" has a match in /$regexp/');
88 } 91 }
92
93 int length(Link link) => link.isEmpty() ? 0 : length(link.tail) + 1;
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/patch_parser.dart ('k') | dart/tests/compiler/dart2js/metadata_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698