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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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' 7 import 'dart:_interceptors'
8 show findInterceptorForType, findConstructorForNativeSubclassType; 8 show findInterceptorForType, findConstructorForNativeSubclassType;
9 9
10 // Test for shadowed fields in classes that extend native classes. 10 // Test for shadowed fields in classes that extend native classes.
11 11
12 @Native("N") 12 @Native("N")
13 class N { 13 class N {
14 N.init(); 14 N.init();
15 } 15 }
16 16
17 class A extends N { 17 class A extends N {
18 var foo = 111; 18 var foo = 111;
19 A.init() : super.init(); 19 A.init() : super.init();
20 } 20 }
21 21
22 class B extends A { 22 class B extends A {
23 var foo = 222; 23 var foo = 222;
24 B.init() : super.init(); 24 B.init() : super.init();
25 25
26 Afoo() => super.foo; 26 Afoo() => super.foo;
27 Bfoo() => foo; 27 Bfoo() => foo;
28 } 28 }
29 29
30 B makeB() native ; 30 B makeB() native;
31 31
32 @Creates('=Object') 32 @Creates('=Object')
33 getBPrototype() native ; 33 getBPrototype() native;
34 34
35 void setup() native r""" 35 void setup() native r"""
36 function B() { } 36 function B() { }
37 makeB = function(){return new B;}; 37 makeB = function(){return new B;};
38 38
39 getBPrototype = function(){return B.prototype;}; 39 getBPrototype = function(){return B.prototype;};
40 """; 40 """;
41 41
42 main() { 42 main() {
43 nativeTesting(); 43 nativeTesting();
44 setup(); 44 setup();
45 45
46 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B)); 46 setNativeSubclassDispatchRecord(getBPrototype(), findInterceptorForType(B));
47 47
48 B b = makeB(); 48 B b = makeB();
49 49
50 var constructor = findConstructorForNativeSubclassType(B, 'init'); 50 var constructor = findConstructorForNativeSubclassType(B, 'init');
51 Expect.isNotNull(constructor); 51 Expect.isNotNull(constructor);
52 JS('', '#(#)', constructor, b); 52 JS('', '#(#)', constructor, b);
53 53
54 print(b); 54 print(b);
55 55
56 Expect.equals(222, confuse(b).Bfoo()); 56 Expect.equals(222, confuse(b).Bfoo());
57 Expect.equals(111, confuse(b).Afoo()); 57 Expect.equals(111, confuse(b).Afoo());
58 58
59 Expect.equals(222, b.Bfoo()); 59 Expect.equals(222, b.Bfoo());
60 Expect.equals(111, b.Afoo()); 60 Expect.equals(111, b.Afoo());
61 } 61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698