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

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

Issue 15985005: Re-apply: Fix type propagation bug by always narrowing types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 9
10 import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t' 10 import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar t'
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 String compile(String code, {String entry: 'main', 47 String compile(String code, {String entry: 'main',
48 String coreSource: DEFAULT_CORELIB, 48 String coreSource: DEFAULT_CORELIB,
49 String interceptorsSource: DEFAULT_INTERCEPTORSLIB, 49 String interceptorsSource: DEFAULT_INTERCEPTORSLIB,
50 bool enableTypeAssertions: false, 50 bool enableTypeAssertions: false,
51 bool minify: false, 51 bool minify: false,
52 bool analyzeAll: false}) { 52 bool analyzeAll: false}) {
53 MockCompiler compiler = 53 MockCompiler compiler =
54 new MockCompiler(enableTypeAssertions: enableTypeAssertions, 54 new MockCompiler(enableTypeAssertions: enableTypeAssertions,
55 coreSource: coreSource, 55 coreSource: coreSource,
56 // Type inference does not run when manually
57 // compiling a method.
58 disableTypeInference: true,
56 interceptorsSource: interceptorsSource, 59 interceptorsSource: interceptorsSource,
57 enableMinification: minify); 60 enableMinification: minify);
58 compiler.parseScript(code); 61 compiler.parseScript(code);
59 lego.Element element = compiler.mainApp.find(buildSourceString(entry)); 62 lego.Element element = compiler.mainApp.find(buildSourceString(entry));
60 if (element == null) return null; 63 if (element == null) return null;
61 compiler.phase = Compiler.PHASE_RESOLVING; 64 compiler.phase = Compiler.PHASE_RESOLVING;
62 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution, 65 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution,
63 compiler.globalDependencies); 66 compiler.globalDependencies);
64 compiler.processQueue(compiler.enqueuer.resolution, element); 67 compiler.processQueue(compiler.enqueuer.resolution, element);
65 compiler.world.populate(); 68 compiler.world.populate();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 final xRe = new RegExp('\\bx\\b'); 209 final xRe = new RegExp('\\bx\\b');
207 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); 210 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)');
208 final spaceRe = new RegExp('\\s+'); 211 final spaceRe = new RegExp('\\s+');
209 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); 212 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)');
210 if (shouldMatch) { 213 if (shouldMatch) {
211 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); 214 Expect.isTrue(new RegExp(regexp).hasMatch(generated));
212 } else { 215 } else {
213 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); 216 Expect.isFalse(new RegExp(regexp).hasMatch(generated));
214 } 217 }
215 } 218 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698