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

Side by Side Diff: dart/tests/compiler/dart2js_native/bound_closure_test.dart

Issue 119673004: Version 1.1.0-dev.5.2 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 11 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 // Test calling convention of property extraction closures. 7 // Test calling convention of property extraction closures.
8 8
9 class AA { 9 class AA {
10 bar(a, [b = 'A']) => 'AA.bar($a, $b)'; // bar is plain dart convention. 10 bar(a, [b = 'A']) => 'AA.bar($a, $b)'; // bar is plain dart convention.
(...skipping 28 matching lines...) Expand all
39 makeBB = function(){return new BB;}; 39 makeBB = function(){return new BB;};
40 makeCC = function(){return new CC;}; 40 makeCC = function(){return new CC;};
41 inscrutable = function(a){return a;}; 41 inscrutable = function(a){return a;};
42 """; 42 """;
43 43
44 44
45 main() { 45 main() {
46 setup(); 46 setup();
47 var a = inscrutable(new AA()); 47 var a = inscrutable(new AA());
48 var b = inscrutable(makeBB()); 48 var b = inscrutable(makeBB());
49 var c = inscrutable(makeCC); 49 var c = inscrutable(makeCC)();
50 50
51 Expect.equals('AA.bar(1, A)', inscrutable(a).bar(1)); 51 Expect.equals('AA.bar(1, A)', inscrutable(a).bar(1));
52 Expect.equals('AA.bar(2, 3)', inscrutable(a).bar(2, 3)); 52 Expect.equals('AA.bar(2, 3)', inscrutable(a).bar(2, 3));
53 53
54 Expect.equals('AA.foo(1, A)', inscrutable(a).foo(1)); 54 Expect.equals('AA.foo(1, A)', inscrutable(a).foo(1));
55 Expect.equals('AA.foo(2, 3)', inscrutable(a).foo(2, 3)); 55 Expect.equals('AA.foo(2, 3)', inscrutable(a).foo(2, 3));
56 56
57 Expect.equals('BB.foo(1, B)', inscrutable(b).foo(1)); 57 Expect.equals('BB.foo(1, B)', inscrutable(b).foo(1));
58 Expect.equals('BB.foo(2, 3)', inscrutable(b).foo(2, 3)); 58 Expect.equals('BB.foo(2, 3)', inscrutable(b).foo(2, 3));
59 59
60 Expect.equals('CC.foo(1, C)', inscrutable(c).foo(1)); 60 Expect.equals('CC.foo(1, C)', inscrutable(c).foo(1));
61 Expect.equals('CC.foo(2, 3)', inscrutable(c).foo(2, 3)); 61 Expect.equals('CC.foo(2, 3)', inscrutable(c).foo(2, 3));
62 62
63 var abar = inscrutable(a).bar; 63 var abar = inscrutable(a).bar;
64 var afoo = inscrutable(a).foo; 64 var afoo = inscrutable(a).foo;
65 var bfoo = inscrutable(b).foo; 65 var bfoo = inscrutable(b).foo;
66 var cfoo = inscrutable(c).foo; 66 var cfoo = inscrutable(c).foo;
67 var csfoo = inscrutable(c).superfoo;
68 67
69 Expect.equals('AA.bar(1, A)', abar(1)); 68 Expect.equals('AA.bar(1, A)', abar(1));
70 Expect.equals('AA.bar(2, 3)', abar(2, 3)); 69 Expect.equals('AA.bar(2, 3)', abar(2, 3));
71 70
72 Expect.equals('AA.foo(1, A)', afoo(1)); 71 Expect.equals('AA.foo(1, A)', afoo(1));
73 Expect.equals('AA.foo(2, 3)', afoo(2, 3)); 72 Expect.equals('AA.foo(2, 3)', afoo(2, 3));
74 73
75 Expect.equals('BB.foo(1, B)', bfoo(1)); 74 Expect.equals('BB.foo(1, B)', bfoo(1));
76 Expect.equals('BB.foo(2, 3)', bfoo(2, 3)); 75 Expect.equals('BB.foo(2, 3)', bfoo(2, 3));
77 76
78 Expect.equals('CC.foo(1, C)', cfoo(1)); 77 Expect.equals('CC.foo(1, C)', cfoo(1));
79 Expect.equals('CC.foo(2, 3)', cfoo(2, 3)); 78 Expect.equals('CC.foo(2, 3)', cfoo(2, 3));
80
81 Expect.equals('BB.foo(1, B)', csfoo(1));
82 Expect.equals('BB.foo(2, 3)', csfoo(2, 3));
83 } 79 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698