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

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

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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:async'; 8 import 'dart:async';
9 import "package:expect/expect.dart"; 9 import "package:expect/expect.dart";
10 10
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 150 }
151 Expect.isNotNull(element, 'Could not locate $name'); 151 Expect.isNotNull(element, 'Could not locate $name');
152 switch (how) { 152 switch (how) {
153 case 'exact': return new types.TypeMask.exact(element); 153 case 'exact': return new types.TypeMask.exact(element);
154 case 'nonNullExact': return new types.TypeMask.nonNullExact(element); 154 case 'nonNullExact': return new types.TypeMask.nonNullExact(element);
155 case 'subclass': return new types.TypeMask.subclass(element); 155 case 'subclass': return new types.TypeMask.subclass(element);
156 case 'nonNullSubclass': return new types.TypeMask.nonNullSubclass(element); 156 case 'nonNullSubclass': return new types.TypeMask.nonNullSubclass(element);
157 case 'subtype': return new types.TypeMask.subtype(element); 157 case 'subtype': return new types.TypeMask.subtype(element);
158 case 'nonNullSubtype': return new types.TypeMask.nonNullSubtype(element); 158 case 'nonNullSubtype': return new types.TypeMask.nonNullSubtype(element);
159 } 159 }
160 Expect.fail('Unknown HType constructor $how'); 160 Expect.fail('Unknown TypeMask constructor $how');
161 }
162
163 ssa.HType findHType(compiler, String name, [String how = 'nonNullExact']) {
164 return new ssa.HType.fromMask(findTypeMask(compiler, name, how), compiler);
165 } 161 }
166 162
167 String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*"; 163 String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*";
168 164
169 String getIntTypeCheck(String variable) { 165 String getIntTypeCheck(String variable) {
170 return "\\($variable ?!== ?\\($variable ?\\| ?0\\)|" 166 return "\\($variable ?!== ?\\($variable ?\\| ?0\\)|"
171 "\\($variable ?>>> ?0 ?!== ?$variable"; 167 "\\($variable ?>>> ?0 ?!== ?$variable";
172 } 168 }
173 169
174 String getNumberTypeCheck(String variable) { 170 String getNumberTypeCheck(String variable) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 final xRe = new RegExp('\\bx\\b'); 210 final xRe = new RegExp('\\bx\\b');
215 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); 211 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)');
216 final spaceRe = new RegExp('\\s+'); 212 final spaceRe = new RegExp('\\s+');
217 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); 213 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)');
218 if (shouldMatch) { 214 if (shouldMatch) {
219 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); 215 Expect.isTrue(new RegExp(regexp).hasMatch(generated));
220 } else { 216 } else {
221 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); 217 Expect.isFalse(new RegExp(regexp).hasMatch(generated));
222 } 218 }
223 } 219 }
OLDNEW
« no previous file with comments | « dart/tests/co19/co19-runtime.status ('k') | dart/tests/compiler/dart2js/cpa_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698