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

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

Issue 11230011: Make hasNext a getter instead of a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unused variable. Created 8 years, 2 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 | « tests/compiler/dart2js/code_motion_test.dart ('k') | tests/compiler/dart2js/gvn_test.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 9
10 import "../../../lib/compiler/implementation/elements/elements.dart" as lego; 10 import "../../../lib/compiler/implementation/elements/elements.dart" as lego;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 String getIntTypeCheck(String variable) { 70 String getIntTypeCheck(String variable) {
71 return "\\($variable ?!== ?\\($variable ?\\| ?0\\)\\)"; 71 return "\\($variable ?!== ?\\($variable ?\\| ?0\\)\\)";
72 } 72 }
73 73
74 String getNumberTypeCheck(String variable) { 74 String getNumberTypeCheck(String variable) {
75 return "\\(typeof $variable ?!== ?'number'\\)"; 75 return "\\(typeof $variable ?!== ?'number'\\)";
76 } 76 }
77 77
78 bool checkNumberOfMatches(Iterator it, int nb) { 78 bool checkNumberOfMatches(Iterator it, int nb) {
79 for (int i = 0; i < nb; i++) { 79 for (int i = 0; i < nb; i++) {
80 Expect.isTrue(it.hasNext(), "Found less than $nb matches"); 80 Expect.isTrue(it.hasNext, "Found less than $nb matches");
81 it.next(); 81 it.next();
82 } 82 }
83 Expect.isFalse(it.hasNext(), "Found more than $nb matches"); 83 Expect.isFalse(it.hasNext, "Found more than $nb matches");
84 } 84 }
85 85
86 void compileAndMatch(String code, String entry, RegExp regexp) { 86 void compileAndMatch(String code, String entry, RegExp regexp) {
87 String generated = compile(code, entry: entry); 87 String generated = compile(code, entry: entry);
88 Expect.isTrue(regexp.hasMatch(generated), 88 Expect.isTrue(regexp.hasMatch(generated),
89 '"$generated" does not match /$regexp/'); 89 '"$generated" does not match /$regexp/');
90 } 90 }
91 91
92 void compileAndDoNotMatch(String code, String entry, RegExp regexp) { 92 void compileAndDoNotMatch(String code, String entry, RegExp regexp) {
93 String generated = compile(code, entry: entry); 93 String generated = compile(code, entry: entry);
(...skipping 20 matching lines...) Expand all
114 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); 114 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)');
115 final spaceRe = new RegExp('\\s+'); 115 final spaceRe = new RegExp('\\s+');
116 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); 116 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)');
117 if (shouldMatch) { 117 if (shouldMatch) {
118 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); 118 Expect.isTrue(new RegExp(regexp).hasMatch(generated));
119 } else { 119 } else {
120 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); 120 Expect.isFalse(new RegExp(regexp).hasMatch(generated));
121 } 121 }
122 } 122 }
123 123
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/code_motion_test.dart ('k') | tests/compiler/dart2js/gvn_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698