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

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

Issue 10831285: Revert "Register toString dynamic invocation in the presence of string interpolation." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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
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");
(...skipping 19 matching lines...) Expand all
30 return compiler; 30 return compiler;
31 } 31 }
32 32
33 String compileAll(String code) { 33 String compileAll(String code) {
34 Uri uri = new Uri.fromComponents(scheme: 'source'); 34 Uri uri = new Uri.fromComponents(scheme: 'source');
35 MockCompiler compiler = compilerFor(code, uri); 35 MockCompiler compiler = compilerFor(code, uri);
36 compiler.runCompiler(uri); 36 compiler.runCompiler(uri);
37 return compiler.assembledCode; 37 return compiler.assembledCode;
38 } 38 }
39 39
40 Element findElement(var compiler, String name) {
41 var element = compiler.mainApp.find(buildSourceString(name));
42 Expect.isNotNull(element, 'Could not locate $name.');
43 return element;
44 }
45
46 String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*"; 40 String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*";
47 41
48 String getIntTypeCheck(String variable) { 42 String getIntTypeCheck(String variable) {
49 return "\\($variable !== \\($variable \\| 0\\)\\)"; 43 return "\\($variable !== \\($variable \\| 0\\)\\)";
50 } 44 }
51 45
52 String getNumberTypeCheck(String variable) { 46 String getNumberTypeCheck(String variable) {
53 return "\\(typeof $variable !== 'number'\\)"; 47 return "\\(typeof $variable !== 'number'\\)";
54 } 48 }
55 49
56 bool checkNumberOfMatches(Iterator it, int nb) { 50 bool checkNumberOfMatches(Iterator it, int nb) {
57 for (int i = 0; i < nb; i++) { 51 for (int i = 0; i < nb; i++) {
58 Expect.isTrue(it.hasNext()); 52 Expect.isTrue(it.hasNext());
59 it.next(); 53 it.next();
60 } 54 }
61 Expect.isFalse(it.hasNext()); 55 Expect.isFalse(it.hasNext());
62 } 56 }
63 57
64 void compileAndMatch(String code, String entry, RegExp regexp) { 58 void compileAndMatch(String code, String entry, RegExp regexp) {
65 String generated = compile(code, entry); 59 String generated = compile(code, entry);
66 Expect.isTrue(regexp.hasMatch(generated), 60 Expect.isTrue(regexp.hasMatch(generated),
67 '"$generated" does not match /$regexp/'); 61 '"$generated" does not match /$regexp/');
68 } 62 }
69 63
70 void compileAndDoNotMatch(String code, String entry, RegExp regexp) { 64 void compileAndDoNotMatch(String code, String entry, RegExp regexp) {
71 String generated = compile(code, entry); 65 String generated = compile(code, entry);
72 Expect.isFalse(regexp.hasMatch(generated), 66 Expect.isFalse(regexp.hasMatch(generated),
73 '"$generated" has a match in /$regexp/'); 67 '"$generated" has a match in /$regexp/');
74 } 68 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/call_site_type_inferer_test.dart ('k') | tests/compiler/dart2js/concrete_type_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698