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

Side by Side Diff: dart/tests/compiler/dart2js_foreign/native_class_inheritance3_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 to see if resolving a hidden native class's method to noSuchMethod 5 // Test to see if resolving a hidden native class's method to noSuchMethod
6 // interferes with subsequent resolving of the method. This might happen if the 6 // interferes with subsequent resolving of the method. This might happen if the
7 // noSuchMethod is cached on Object.prototype. 7 // noSuchMethod is cached on Object.prototype.
8 8
9 @native("*A1") 9 import 'native_metadata.dart';
10
11 @Native("*A1")
10 class A1 { 12 class A1 {
11 } 13 }
12 14
13 @native("*B1") 15 @Native("*B1")
14 class B1 extends A1 { 16 class B1 extends A1 {
15 } 17 }
16 18
17 @native makeA1(); 19 @native makeA1();
18 @native makeB1(); 20 @native makeB1();
19 21
20 22
21 @native("*A2") 23 @Native("*A2")
22 class A2 { 24 class A2 {
23 @native foo([a=99]); 25 @native foo([a=99]);
24 } 26 }
25 27
26 @native("*B2") 28 @Native("*B2")
27 class B2 extends A2 { 29 class B2 extends A2 {
28 } 30 }
29 31
30 @native makeA2(); 32 @native makeA2();
31 @native makeB2(); 33 @native makeB2();
32 34
33 @native makeObject(); 35 @native makeObject();
34 36
35 @native(""" 37 @Native("""
36 // This code is all inside 'setup' and so not accesible from the global scope. 38 // This code is all inside 'setup' and so not accesible from the global scope.
37 function inherits(child, parent) { 39 function inherits(child, parent) {
38 if (child.prototype.__proto__) { 40 if (child.prototype.__proto__) {
39 child.prototype.__proto__ = parent.prototype; 41 child.prototype.__proto__ = parent.prototype;
40 } else { 42 } else {
41 function tmp() {}; 43 function tmp() {};
42 tmp.prototype = parent.prototype; 44 tmp.prototype = parent.prototype;
43 child.prototype = new tmp(); 45 child.prototype = new tmp();
44 child.prototype.constructor = child; 46 child.prototype.constructor = child;
45 } 47 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 expectNoSuchMethod(action, note) { 95 expectNoSuchMethod(action, note) {
94 bool caught = false; 96 bool caught = false;
95 try { 97 try {
96 action(); 98 action();
97 } catch (ex) { 99 } catch (ex) {
98 caught = true; 100 caught = true;
99 Expect.isTrue(ex is NoSuchMethodError, note); 101 Expect.isTrue(ex is NoSuchMethodError, note);
100 } 102 }
101 Expect.isTrue(caught, note); 103 Expect.isTrue(caught, note);
102 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698