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

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

Issue 9956152: Reapply "Refactor type propagation." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Apply fix. 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));
55 52
56 regexp = new RegExp("sum = \\(?$anyIdentifier \\+ $anyIdentifier\\)?"); 53 RegExp regexp = new RegExp("sum = \\(?$anyIdentifier \\+ $anyIdentifier\\)?");
57 Expect.isTrue(regexp.hasMatch(generated));
58
59 regexp = const RegExp("typeof param0 !== 'number'");
60 Expect.isTrue(regexp.hasMatch(generated)); 54 Expect.isTrue(regexp.hasMatch(generated));
61 55
62 regexp = const RegExp("typeof param1 !== 'number'"); 56 regexp = const RegExp("typeof param1 !== 'number'");
63 Expect.isTrue(regexp.hasMatch(generated)); 57 Expect.isTrue(regexp.hasMatch(generated));
64 58
65 generated = compile(TEST_TWO, 'foo'); 59 generated = compile(TEST_TWO, 'foo');
66 regexp = new RegExp(getNumberTypeCheck('param0')); 60 regexp = new RegExp(getNumberTypeCheck('param0'));
67 Expect.isTrue(regexp.hasMatch(generated)); 61 Expect.isTrue(regexp.hasMatch(generated));
68 62
69 regexp = const RegExp('-param0'); 63 regexp = const RegExp('-param0');
(...skipping 12 matching lines...) Expand all
82 Expect.isTrue(regexp.hasMatch(generated)); 76 Expect.isTrue(regexp.hasMatch(generated));
83 Expect.isTrue(!generated.contains('index')); 77 Expect.isTrue(!generated.contains('index'));
84 Expect.isTrue(!generated.contains('indexSet')); 78 Expect.isTrue(!generated.contains('indexSet'));
85 79
86 generated = compile(TEST_FIVE, 'foo'); 80 generated = compile(TEST_FIVE, 'foo');
87 regexp = const RegExp('a.constructor !== Array'); 81 regexp = const RegExp('a.constructor !== Array');
88 Expect.isTrue(regexp.hasMatch(generated)); 82 Expect.isTrue(regexp.hasMatch(generated));
89 Expect.isTrue(!generated.contains('index')); 83 Expect.isTrue(!generated.contains('index'));
90 Expect.isTrue(!generated.contains('indexSet')); 84 Expect.isTrue(!generated.contains('indexSet'));
91 } 85 }
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