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

Side by Side Diff: dart/tests/compiler/dart2js_foreign/native_class_is_check1_test.dart

Issue 11293272: Update dart2js_foreign suite as we now validate annotations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 // Test for correct simple is-checks on hidden native classes. 5 // Test for correct simple is-checks on hidden native classes.
6 6
7 import 'native_metadata.dart';
8
7 interface I { 9 interface I {
8 I read(); 10 I read();
9 write(I x); 11 write(I x);
10 } 12 }
11 13
12 // Native implementation. 14 // Native implementation.
13 15
14 @native("*A") 16 @Native("*A")
15 class A implements I { 17 class A implements I {
16 // The native class accepts only other native instances. 18 // The native class accepts only other native instances.
17 @native A read(); 19 @native A read();
18 @native write(A x); 20 @native write(A x);
19 } 21 }
20 22
21 @native makeA(); 23 @native makeA();
22 24
23 @native(""" 25 @Native("""
24 // This code is all inside 'setup' and so not accesible from the global scope. 26 // This code is all inside 'setup' and so not accesible from the global scope.
25 function A(){} 27 function A(){}
26 A.prototype.read = function() { return this._x; }; 28 A.prototype.read = function() { return this._x; };
27 A.prototype.write = function(x) { this._x = x; }; 29 A.prototype.write = function(x) { this._x = x; };
28 makeA = function(){return new A}; 30 makeA = function(){return new A};
29 """) 31 """)
30 void setup(); 32 void setup();
31 33
32 class B {} 34 class B {}
33 35
34 main() { 36 main() {
35 setup(); 37 setup();
36 38
37 var a1 = makeA(); 39 var a1 = makeA();
38 var ob = new Object(); 40 var ob = new Object();
39 41
40 Expect.isFalse(ob is I); 42 Expect.isFalse(ob is I);
41 Expect.isFalse(ob is A); 43 Expect.isFalse(ob is A);
42 Expect.isFalse(ob is B); 44 Expect.isFalse(ob is B);
43 45
44 Expect.isTrue(a1 is I); 46 Expect.isTrue(a1 is I);
45 Expect.isTrue(a1 is A); 47 Expect.isTrue(a1 is A);
46 Expect.isTrue(a1 is !B); 48 Expect.isTrue(a1 is !B);
47 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698