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

Side by Side Diff: tests/compiler/dart2js_native/subclassing_2_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
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 import 'dart:_js_helper' show setNativeSubclassDispatchRecord; 6 import 'dart:_js_helper' show setNativeSubclassDispatchRecord;
7 import 'dart:_interceptors' show findInterceptorForType; 7 import 'dart:_interceptors' show findInterceptorForType;
8 8
9 // Test calling convention of methods introduced on subclasses of native 9 // Test calling convention of methods introduced on subclasses of native
10 // classes. 10 // classes.
11 11
12 doFoo(r, x) => '$x,${r.oof()}'; 12 doFoo(r, x) => '$x,${r.oof()}';
13 13
14 @Native("A") 14 @Native("A")
15 class A { 15 class A {
16 foo(x) => (doFoo)(this, x); 16 foo(x) => (doFoo)(this, x);
17 } 17 }
18 18
19 class B extends A { 19 class B extends A {
20 // [oof] is introduced only on this subclass of a native class. It should 20 // [oof] is introduced only on this subclass of a native class. It should
21 // have interceptor calling convention. 21 // have interceptor calling convention.
22 oof() => 'B'; 22 oof() => 'B';
23 } 23 }
24 24
25 B makeB() native; 25 B makeB() native;
26 26
27 @Creates('=Object') 27 @Creates('=Object')
28 getBPrototype() native; 28 getBPrototype() native;
29 29
30 void setup() native r""" 30 void setup() {
31 function A() {} 31 JS('', r"""
32 function B() {} 32 (function(){
33 makeA = function(){return new A;}; 33 function A() {}
34 makeB = function(){return new B;}; 34 function B() {}
35 makeA = function(){return new A()};
36 makeB = function(){return new B()};
35 37
36 getBPrototype = function(){return B.prototype;}; 38 getBPrototype = function(){return B.prototype;};
37 """; 39 })()""");
40 }
38 41
39 main() { 42 main() {
40 nativeTesting(); 43 nativeTesting();
41 setup(); 44 setup();
42 45
43 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); 46 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B));
44 47
45 B b = makeB(); 48 B b = makeB();
46 Expect.equals('1,B', b.foo(1)); 49 Expect.equals('1,B', b.foo(1));
47 } 50 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js_native/subclassing_1_test.dart ('k') | tests/compiler/dart2js_native/subclassing_3_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698