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

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

Issue 2990083002: dart2js_native tests: Migrate 'native STRING' to JS-calls - part 2/2 (Closed)
Patch Set: remove defunct comments 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Regression test for Issue 9182. The generative constructor body function 5 // Regression test for Issue 9182. The generative constructor body function
6 // should not have the interceptor calling convention. 6 // should not have the interceptor calling convention.
7 7
8 import "native_testing.dart"; 8 import "native_testing.dart";
9 9
10 @Native("A") 10 @Native("A")
11 class Foo { 11 class Foo {
12 factory Foo() => makeA(); 12 factory Foo() => makeA();
13 // Ensure the instance method 'Bar' uses interceptor convention. 13 // Ensure the instance method 'Bar' uses interceptor convention.
14 Bar() => 123; 14 Bar() => 123;
15 } 15 }
16 16
17 class Bar { 17 class Bar {
18 var _x, _y; 18 var _x, _y;
19 // Generative constructor with body, having the same name as interceptor 19 // Generative constructor with body, having the same name as interceptor
20 // convention instance member. 20 // convention instance member.
21 Bar(x, y) { 21 Bar(x, y) {
22 _x = x; 22 _x = x;
23 _y = y; 23 _y = y;
24 } 24 }
25 } 25 }
26 26
27 void setup() native r""" 27 void setup() {
28 function A(){} 28 JS('', r"""
29 makeA = function() { return new A; }; 29 (function(){
30 self.nativeConstructor(A); 30 function A(){}
31 """; 31 makeA = function() { return new A() };
32 self.nativeConstructor(A);
33 })()""");
34 }
32 35
33 makeA() native; 36 makeA() native;
34 37
35 main() { 38 main() {
36 nativeTesting(); 39 nativeTesting();
37 setup(); 40 setup();
38 41
39 var foo = confuse(new Foo()); 42 var foo = confuse(new Foo());
40 var bar = confuse(new Bar(30, 40)); 43 var bar = confuse(new Bar(30, 40));
41 44
42 Expect.equals(123, foo.Bar()); // Ensure that Foo.Bar is used. 45 Expect.equals(123, foo.Bar()); // Ensure that Foo.Bar is used.
43 46
44 Expect.equals(30, bar._x); 47 Expect.equals(30, bar._x);
45 Expect.equals(40, bar._y); 48 Expect.equals(40, bar._y);
46 } 49 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js_native/fixup_get_tag_test.dart ('k') | tests/compiler/dart2js_native/jsobject_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698