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

Side by Side Diff: tests/compiler/dart2js_native/subclassing_1_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) 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 "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'dart:_js_helper' show Creates, setNativeSubclassDispatchRecord; 6 import 'dart:_js_helper' show Native, Creates, setNativeSubclassDispatchRecord;
7 import 'dart:_interceptors' show findInterceptorForType; 7 import 'dart:_interceptors' show findInterceptorForType;
8 8
9 // Test that subclasses of native classes can be defined by setting the dispatch 9 // Test that subclasses of native classes can be defined by setting the dispatch
10 // record. 10 // record.
11 11
12 class A native "A" { 12 @Native("A")
13 class A {
13 foo(x) => '$x,${this.oof()}'; 14 foo(x) => '$x,${this.oof()}';
14 oof() => 'A'; 15 oof() => 'A';
15 } 16 }
16 17
17 class B extends A { 18 class B extends A {
18 oof() => 'B'; 19 oof() => 'B';
19 } 20 }
20 21
21 B makeB1() native; 22 B makeB1() native;
22 B makeB2() native; 23 B makeB2() native;
(...skipping 26 matching lines...) Expand all
49 50
50 B b1 = makeB1(); 51 B b1 = makeB1();
51 Expect.equals('1,B', b1.foo(1)); 52 Expect.equals('1,B', b1.foo(1));
52 53
53 B b2 = makeB2(); 54 B b2 = makeB2();
54 Expect.equals('2,B', b2.foo(2)); 55 Expect.equals('2,B', b2.foo(2));
55 56
56 B b3 = makeC(); 57 B b3 = makeC();
57 Expect.equals('3,B', b3.foo(3)); 58 Expect.equals('3,B', b3.foo(3));
58 } 59 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js_native/runtimetype_test.dart ('k') | tests/compiler/dart2js_native/subclassing_2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698