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

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

Issue 383413003: Add @Native(...) annotation for native class names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 5 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "dart:_js_helper";
5 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
6 7
7 // Test to see if resolving a hidden native class's method interferes with 8 // Test to see if resolving a hidden native class's method interferes with
8 // subsequent resolving the subclass's method. This might happen if the 9 // subsequent resolving the subclass's method. This might happen if the
9 // superclass caches the method in the prototype, so shadowing the dispatcher 10 // superclass caches the method in the prototype, so shadowing the dispatcher
10 // stored on Object.prototype. 11 // stored on Object.prototype.
11 12
12 class A native "A" { 13 @Native("A")
14 class A {
13 foo([a=100]) native; 15 foo([a=100]) native;
14 } 16 }
15 17
16 class B extends A native "B" { 18 @Native("B")
19 class B extends A {
17 } 20 }
18 21
19 class C extends B native "C" { 22 @Native("C")
23 class C extends B {
20 foo([z=300]) native; 24 foo([z=300]) native;
21 } 25 }
22 26
23 class D extends C native "D" { 27 @Native("D")
28 class D extends C {
24 } 29 }
25 30
26 makeA() native; 31 makeA() native;
27 makeB() native; 32 makeB() native;
28 makeC() native; 33 makeC() native;
29 makeD() native; 34 makeD() native;
30 35
31 void setup() native """ 36 void setup() native """
32 // This code is all inside 'setup' and so not accesible from the global scope. 37 // This code is all inside 'setup' and so not accesible from the global scope.
33 function inherits(child, parent) { 38 function inherits(child, parent) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 Expect.equals('C.foo(300)', d.foo()); 76 Expect.equals('C.foo(300)', d.foo());
72 // If the above line fails with C.foo(100) then the dispatch to fill in the 77 // If the above line fails with C.foo(100) then the dispatch to fill in the
73 // default got the wrong one, followed by a second dispatch that resolved to 78 // default got the wrong one, followed by a second dispatch that resolved to
74 // the correct native method. 79 // the correct native method.
75 80
76 Expect.equals('A.foo(1)', a.foo(1)); 81 Expect.equals('A.foo(1)', a.foo(1));
77 Expect.equals('A.foo(2)', b.foo(2)); 82 Expect.equals('A.foo(2)', b.foo(2));
78 Expect.equals('C.foo(3)', c.foo(3)); 83 Expect.equals('C.foo(3)', c.foo(3));
79 Expect.equals('C.foo(4)', d.foo(4)); 84 Expect.equals('C.foo(4)', d.foo(4));
80 } 85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698