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

Side by Side Diff: frog/tests/leg/class_codegen2_test.dart

Issue 10536169: Move frog/tests/{leg,leg_only,frog_native} to tests/compiler/. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« no previous file with comments | « frog/tests/leg/builtin_interceptor_test.dart ('k') | frog/tests/leg/class_codegen_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 // Test that parameters keep their names in the output.
5
6 #import("compiler_helper.dart");
7 #import("parser_helper.dart");
8
9 final String TEST_ONE = @"""
10 class A { foo() => 499; }
11 class B { bar() => 42; }
12
13 main() {
14 new A().foo();
15 new B().bar();
16 }
17 """;
18
19 final String TEST_TWO = @"""
20 class A {
21 foo() => 499;
22 bar() => 42;
23 }
24
25 main() {
26 new A().foo();
27 new A().bar();
28 }
29 """;
30
31 final String TEST_THREE = @"""
32 class A {
33 foo() => 499;
34 bar() => 42;
35 }
36
37 class B extends A {
38 foo() => -499;
39 bar() => -42;
40 }
41
42 var y;
43 foo(i) {
44 if (0 != i) {
45 y--;
46 foo(i - 1);
47 y++;
48 }
49 }
50
51 makeStaticInliningHard() {
52 y = 0;
53 foo(10);
54 return 0 == y;
55 }
56
57
58 // id returns [x] in a way that should be difficult to predict statically.
59 id(x) {
60 y = x;
61 foo(10);
62 return y;
63 }
64
65 main() {
66 var a = new A();
67 var b = new B();
68 var x = a;
69 if (makeStaticInliningHard()) x = b;
70 x.foo();
71 x.bar();
72 }
73 """;
74
75 final String TEST_FOUR = @"""
76 class A { foo() => 499; }
77
78 foo(f) { f(); }
79
80 main() {
81 foo(new A().foo);
82 }
83 """;
84
85 main() {
86 // At some point Dart2js generated bad object literals with dangling commas:
87 // { a: true, }. Make sure this doesn't happen again.
88 RegExp danglingComma = const RegExp(@',[ \n]*}');
89 String generated = compileAll(TEST_ONE);
90 Expect.isFalse(danglingComma.hasMatch(generated));
91
92 generated = compileAll(TEST_TWO);
93 Expect.isFalse(danglingComma.hasMatch(generated));
94
95 generated = compileAll(TEST_THREE);
96 Expect.isFalse(danglingComma.hasMatch(generated));
97
98 generated = compileAll(TEST_FOUR);
99 Expect.isFalse(danglingComma.hasMatch(generated));
100 }
OLDNEW
« no previous file with comments | « frog/tests/leg/builtin_interceptor_test.dart ('k') | frog/tests/leg/class_codegen_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698