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

Side by Side Diff: tests/compiler/dart2js_native/native_field_invocation5_test.dart

Issue 2984403002: dart2js_native tests: Migrate 'native STRING' to JS-calls (Closed)
Patch Set: the rest of the files Created 3 years, 4 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
OLDNEW
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() {
11 function CC() {} 11 JS('', r"""
12 makeCC = function() { return new CC; } 12 (function(){
13 nativeFirst = function(x, y) { return x; } 13 function CC() {}
14 self.nativeConstructor(CC); 14 makeCC = function() { return new CC() };
15 """; 15 nativeFirst = function(x, y) { return x; };
16 self.nativeConstructor(CC);
17 })()""");
18 }
16 19
17 class C { 20 class C {
18 foo(x) => x; 21 foo(x) => x;
19 } 22 }
20 23
21 @Native("CC") 24 @Native("CC")
22 class ClickCounter { 25 class ClickCounter {
23 var status; 26 var status;
24 27
25 var foo; 28 var foo;
(...skipping 16 matching lines...) Expand all
42 setup(); 45 setup();
43 var c = makeCC(); 46 var c = makeCC();
44 c.init(); 47 c.init();
45 var c2 = new C(); 48 var c2 = new C();
46 c = nativeFirst(c, c2); 49 c = nativeFirst(c, c2);
47 // After the `nativeFirst` invocation dart2js doesn't know if c is a 50 // 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 51 // ClickCounter or C. It must go through the interceptor and call the foo$1
49 // invocation. 52 // invocation.
50 Expect.equals("### !!! 499 !!! ###", c.foo(499)); 53 Expect.equals("### !!! 499 !!! ###", c.foo(499));
51 } 54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698