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

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

Issue 2990083002: dart2js_native tests: Migrate 'native STRING' to JS-calls - part 2/2 (Closed)
Patch Set: remove defunct comments Created 3 years, 4 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
« no previous file with comments | « no previous file | tests/compiler/dart2js_native/browser_compat_1_prepatched_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
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 'native_testing.dart'; 5 import 'native_testing.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.
11 foo(a, [b = 'A']) => 'AA.foo($a, $b)'; // foo has interceptor convention. 11 foo(a, [b = 'A']) => 'AA.foo($a, $b)'; // foo has interceptor convention.
12 } 12 }
13 13
14 @Native("BB") 14 @Native("BB")
15 class BB { 15 class BB {
16 foo(a, [b = 'B']) native; 16 foo(a, [b = 'B']) native;
17 } 17 }
18 18
19 @Native("CC") 19 @Native("CC")
20 class CC extends BB { 20 class CC extends BB {
21 foo(a, [b = 'C']) native; 21 foo(a, [b = 'C']) native;
22 22
23 get superfoo => super.foo; 23 get superfoo => super.foo;
24 } 24 }
25 25
26 makeBB() native; 26 makeBB() native;
27 makeCC() native; 27 makeCC() native;
28 inscrutable(a) native; 28 inscrutable(a) native;
29 29
30 void setup() native r""" 30 void setup() {
31 function BB() {} 31 JS('', r"""
32 BB.prototype.foo = function(u, v) { 32 (function(){
33 return 'BB.foo(' + u + ', ' + v + ')'; 33 function BB() {}
34 }; 34 BB.prototype.foo = function(u, v) {
35 return 'BB.foo(' + u + ', ' + v + ')';
36 };
35 37
36 function CC() {} 38 function CC() {}
37 CC.prototype.foo = function(u, v) { 39 CC.prototype.foo = function(u, v) {
38 return 'CC.foo(' + u + ', ' + v + ')'; 40 return 'CC.foo(' + u + ', ' + v + ')';
39 }; 41 };
40 42
41 makeBB = function(){return new BB;}; 43 makeBB = function(){return new BB()};
42 makeCC = function(){return new CC;}; 44 makeCC = function(){return new CC()};
43 inscrutable = function(a){return a;}; 45 inscrutable = function(a){return a;};
44 46
45 self.nativeConstructor(BB); 47 self.nativeConstructor(BB);
46 self.nativeConstructor(CC); 48 self.nativeConstructor(CC);
47 """; 49 })()""");
50 }
48 51
49 main() { 52 main() {
50 nativeTesting(); 53 nativeTesting();
51 setup(); 54 setup();
52 var a = inscrutable(new AA()); 55 var a = inscrutable(new AA());
53 var b = inscrutable(makeBB()); 56 var b = inscrutable(makeBB());
54 var c = inscrutable(makeCC)(); 57 var c = inscrutable(makeCC)();
55 58
56 Expect.equals('AA.bar(1, A)', inscrutable(a).bar(1)); 59 Expect.equals('AA.bar(1, A)', inscrutable(a).bar(1));
57 Expect.equals('AA.bar(2, 3)', inscrutable(a).bar(2, 3)); 60 Expect.equals('AA.bar(2, 3)', inscrutable(a).bar(2, 3));
(...skipping 17 matching lines...) Expand all
75 78
76 Expect.equals('AA.foo(1, A)', afoo(1)); 79 Expect.equals('AA.foo(1, A)', afoo(1));
77 Expect.equals('AA.foo(2, 3)', afoo(2, 3)); 80 Expect.equals('AA.foo(2, 3)', afoo(2, 3));
78 81
79 Expect.equals('BB.foo(1, B)', bfoo(1)); 82 Expect.equals('BB.foo(1, B)', bfoo(1));
80 Expect.equals('BB.foo(2, 3)', bfoo(2, 3)); 83 Expect.equals('BB.foo(2, 3)', bfoo(2, 3));
81 84
82 Expect.equals('CC.foo(1, C)', cfoo(1)); 85 Expect.equals('CC.foo(1, C)', cfoo(1));
83 Expect.equals('CC.foo(2, 3)', cfoo(2, 3)); 86 Expect.equals('CC.foo(2, 3)', cfoo(2, 3));
84 } 87 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js_native/browser_compat_1_prepatched_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698