OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 | 6 |
7 makeCC() native ; | 7 makeCC() native; |
8 nativeFirst(x, y) native ; | 8 nativeFirst(x, y) native; |
9 | 9 |
10 void setup() native """ | 10 void setup() native """ |
11 function CC() {} | 11 function CC() {} |
12 makeCC = function() { return new CC; } | 12 makeCC = function() { return new CC; } |
13 nativeFirst = function(x, y) { return x; } | 13 nativeFirst = function(x, y) { return x; } |
14 self.nativeConstructor(CC); | 14 self.nativeConstructor(CC); |
15 """; | 15 """; |
16 | 16 |
17 class C { | 17 class C { |
18 foo(x) => x; | 18 foo(x) => x; |
(...skipping 23 matching lines...) Expand all Loading... |
42 setup(); | 42 setup(); |
43 var c = makeCC(); | 43 var c = makeCC(); |
44 c.init(); | 44 c.init(); |
45 var c2 = new C(); | 45 var c2 = new C(); |
46 c = nativeFirst(c, c2); | 46 c = nativeFirst(c, c2); |
47 // After the `nativeFirst` invocation dart2js doesn't know if c is a | 47 // After the `nativeFirst` invocation dart2js doesn't know if c is a |
48 // ClickCounter or C. It must go through the interceptor and call the foo$1 | 48 // ClickCounter or C. It must go through the interceptor and call the foo$1 |
49 // invocation. | 49 // invocation. |
50 Expect.equals("### !!! 499 !!! ###", c.foo(499)); | 50 Expect.equals("### !!! 499 !!! ###", c.foo(499)); |
51 } | 51 } |
OLD | NEW |