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

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

Issue 24952003: Change TypeMask.base to be a ClassElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moar declaration. Created 7 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
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 [String how = 'nonNullExact']) { 141 [String how = 'nonNullExact']) {
142 var sourceName = buildSourceString(name); 142 var sourceName = buildSourceString(name);
143 var element = compiler.mainApp.find(sourceName); 143 var element = compiler.mainApp.find(sourceName);
144 if (element == null) { 144 if (element == null) {
145 element = compiler.interceptorsLibrary.find(sourceName); 145 element = compiler.interceptorsLibrary.find(sourceName);
146 } 146 }
147 if (element == null) { 147 if (element == null) {
148 element = compiler.coreLibrary.find(sourceName); 148 element = compiler.coreLibrary.find(sourceName);
149 } 149 }
150 Expect.isNotNull(element, 'Could not locate $name'); 150 Expect.isNotNull(element, 'Could not locate $name');
151 var dartType = element.computeType(compiler);
152 switch (how) { 151 switch (how) {
153 case 'exact': return new types.TypeMask.exact(dartType); 152 case 'exact': return new types.TypeMask.exact(element);
154 case 'nonNullExact': return new types.TypeMask.nonNullExact(dartType); 153 case 'nonNullExact': return new types.TypeMask.nonNullExact(element);
155 case 'subclass': return new types.TypeMask.subclass(dartType); 154 case 'subclass': return new types.TypeMask.subclass(element);
156 case 'nonNullSubclass': return new types.TypeMask.nonNullSubclass(dartType); 155 case 'nonNullSubclass': return new types.TypeMask.nonNullSubclass(element);
157 case 'subtype': return new types.TypeMask.subtype(dartType); 156 case 'subtype': return new types.TypeMask.subtype(element);
158 case 'nonNullSubtype': return new types.TypeMask.nonNullSubtype(dartType); 157 case 'nonNullSubtype': return new types.TypeMask.nonNullSubtype(element);
159 } 158 }
160 Expect.fail('Unknown HType constructor $how'); 159 Expect.fail('Unknown HType constructor $how');
161 } 160 }
162 161
163 ssa.HType findHType(compiler, String name, [String how = 'nonNullExact']) { 162 ssa.HType findHType(compiler, String name, [String how = 'nonNullExact']) {
164 return new ssa.HType.fromMask(findTypeMask(compiler, name, how), compiler); 163 return new ssa.HType.fromMask(findTypeMask(compiler, name, how), compiler);
165 } 164 }
166 165
167 String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*"; 166 String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*";
168 167
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 final xRe = new RegExp('\\bx\\b'); 213 final xRe = new RegExp('\\bx\\b');
215 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); 214 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)');
216 final spaceRe = new RegExp('\\s+'); 215 final spaceRe = new RegExp('\\s+');
217 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); 216 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)');
218 if (shouldMatch) { 217 if (shouldMatch) {
219 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); 218 Expect.isTrue(new RegExp(regexp).hasMatch(generated));
220 } else { 219 } else {
221 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); 220 Expect.isFalse(new RegExp(regexp).hasMatch(generated));
222 } 221 }
223 } 222 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/world.dart ('k') | tests/compiler/dart2js/cpa_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698