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

Side by Side Diff: frog/tests/leg/src/TypeInferenceTest.dart

Issue 10106004: Revert "Refactor type propagation." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 4
5 #import("compiler_helper.dart"); 5 #import("compiler_helper.dart");
6 6
7 final String TEST_ONE = @""" 7 final String TEST_ONE = @"""
8 sum(param0, param1) { 8 sum(param0, param1) {
9 var sum = 0; 9 var sum = 0;
10 for (var i = param0; i < param1; i += 1) sum = sum + i; 10 for (var i = param0; i < param1; i += 1) sum = sum + i;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 main(a) { 42 main(a) {
43 print(a[0]); 43 print(a[0]);
44 while (true) { 44 while (true) {
45 a[0] = a[1]; 45 a[0] = a[1];
46 } 46 }
47 } 47 }
48 """; 48 """;
49 49
50 main() { 50 main() {
51 String generated = compile(TEST_ONE, 'sum'); 51 String generated = compile(TEST_ONE, 'sum');
52 RegExp regexp = new RegExp("i = \\(?$anyIdentifier \\+ \\(1\\)\\)?");
53 // TODO(ngeoffray): Do live range analysis to make this test pass.
54 Expect.isFalse(regexp.hasMatch(generated));
52 55
53 Regexp regexp = new RegExp("sum = \\(?$anyIdentifier \\+ $anyIdentifier\\)?"); 56 regexp = new RegExp("sum = \\(?$anyIdentifier \\+ $anyIdentifier\\)?");
57 Expect.isTrue(regexp.hasMatch(generated));
58
59 regexp = const RegExp("typeof param0 !== 'number'");
54 Expect.isTrue(regexp.hasMatch(generated)); 60 Expect.isTrue(regexp.hasMatch(generated));
55 61
56 regexp = const RegExp("typeof param1 !== 'number'"); 62 regexp = const RegExp("typeof param1 !== 'number'");
57 Expect.isTrue(regexp.hasMatch(generated)); 63 Expect.isTrue(regexp.hasMatch(generated));
58 64
59 generated = compile(TEST_TWO, 'foo'); 65 generated = compile(TEST_TWO, 'foo');
60 regexp = new RegExp(getNumberTypeCheck('param0')); 66 regexp = new RegExp(getNumberTypeCheck('param0'));
61 Expect.isTrue(regexp.hasMatch(generated)); 67 Expect.isTrue(regexp.hasMatch(generated));
62 68
63 regexp = const RegExp('-param0'); 69 regexp = const RegExp('-param0');
(...skipping 12 matching lines...) Expand all
76 Expect.isTrue(regexp.hasMatch(generated)); 82 Expect.isTrue(regexp.hasMatch(generated));
77 Expect.isTrue(!generated.contains('index')); 83 Expect.isTrue(!generated.contains('index'));
78 Expect.isTrue(!generated.contains('indexSet')); 84 Expect.isTrue(!generated.contains('indexSet'));
79 85
80 generated = compile(TEST_FIVE, 'foo'); 86 generated = compile(TEST_FIVE, 'foo');
81 regexp = const RegExp('a.constructor !== Array'); 87 regexp = const RegExp('a.constructor !== Array');
82 Expect.isTrue(regexp.hasMatch(generated)); 88 Expect.isTrue(regexp.hasMatch(generated));
83 Expect.isTrue(!generated.contains('index')); 89 Expect.isTrue(!generated.contains('index'));
84 Expect.isTrue(!generated.contains('indexSet')); 90 Expect.isTrue(!generated.contains('indexSet'));
85 } 91 }
OLDNEW
« no previous file with comments | « frog/tests/leg/src/TypeInference3Test.dart ('k') | lib/compiler/implementation/ssa/bailout.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698