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

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

Issue 2984403002: dart2js_native tests: Migrate 'native STRING' to JS-calls (Closed)
Patch Set: the rest of the files 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
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 that native classes and plain classes can access methods defined only by 7 // Test that native classes and plain classes can access methods defined only by
8 // the same mixin. 8 // the same mixin.
9 9
10 class D extends Object with M1, M2, M3 {} 10 class D extends Object with M1, M2, M3 {}
(...skipping 20 matching lines...) Expand all
31 31
32 @Native("C") 32 @Native("C")
33 class C extends B { 33 class C extends B {
34 foo() => 'C.foo'; 34 foo() => 'C.foo';
35 } 35 }
36 36
37 makeA() native; 37 makeA() native;
38 makeB() native; 38 makeB() native;
39 makeC() native; 39 makeC() native;
40 40
41 void setup() native """ 41 void setup() {
42 function A() {} 42 JS('', r"""
43 function B() {} 43 (function(){
44 function C() {} 44 function A() {}
45 makeA = function(){return new A;}; 45 function B() {}
46 makeB = function(){return new B;}; 46 function C() {}
47 makeC = function(){return new C;}; 47 makeA = function(){return new A()};
48 makeB = function(){return new B()};
49 makeC = function(){return new C()};
48 50
49 self.nativeConstructor(A); 51 self.nativeConstructor(A);
50 self.nativeConstructor(B); 52 self.nativeConstructor(B);
51 self.nativeConstructor(C); 53 self.nativeConstructor(C);
52 """; 54 })()""");
55 }
53 56
54 var g; 57 var g;
55 58
56 callFoo(x) { 59 callFoo(x) {
57 // Dominating getInterceptor call should be shared. 60 // Dominating getInterceptor call should be shared.
58 g = x.toString(); 61 g = x.toString();
59 // These call sites are partitioned into pure-dart and native subsets, 62 // These call sites are partitioned into pure-dart and native subsets,
60 // allowing differences in getInterceptors. 63 // allowing differences in getInterceptors.
61 if (x is D) return x.foo(); 64 if (x is D) return x.foo();
62 if (x is A) return x.foo(); 65 if (x is A) return x.foo();
(...skipping 19 matching lines...) Expand all
82 var e = x[4]; 85 var e = x[4];
83 86
84 var f = callFoo; 87 var f = callFoo;
85 88
86 Expect.equals('A.foo', f(a)); 89 Expect.equals('A.foo', f(a));
87 Expect.equals('M2.foo', f(b)); 90 Expect.equals('M2.foo', f(b));
88 Expect.equals('C.foo', f(c)); 91 Expect.equals('C.foo', f(c));
89 Expect.equals('M2.foo', f(d)); 92 Expect.equals('M2.foo', f(d));
90 Expect.equals('E.foo', f(e)); 93 Expect.equals('E.foo', f(e));
91 } 94 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698