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