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

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

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 years, 3 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 "dart:_js_helper"; 5 import "dart:_js_helper";
6 import "package:expect/expect.dart"; 6 import "package:expect/expect.dart";
7 7
8 @Native("A") 8 @Native("A")
9 class A { 9 class A {
10 var foo; 10 var foo;
11 } 11 }
12 12
13 class B { 13 class B {
14 var foo; 14 var foo;
15 } 15 }
16 16
17 nativeId(x) native; 17 nativeId(x) native ;
18 18
19 void setup() native """ 19 void setup() native """
20 nativeId = function(x) { return x; } 20 nativeId = function(x) { return x; }
21 """; 21 """;
22 22
23 main() { 23 main() {
24 setup(); 24 setup();
25 var b = new B(); 25 var b = new B();
26 b.foo = (x) => x + 1; 26 b.foo = (x) => x + 1;
27 b = nativeId(b); // Inferrer doesn't know if A has been instantiated. 27 b = nativeId(b); // Inferrer doesn't know if A has been instantiated.
28 // At this point b could be A or B. The call to "foo" thus needs to go through 28 // At this point b could be A or B. The call to "foo" thus needs to go through
29 // an interceptor. Tests that the interceptor doesn't screw with retrieving 29 // an interceptor. Tests that the interceptor doesn't screw with retrieving
30 // the field and invoking the closure. 30 // the field and invoking the closure.
31 // Use a type-check to guarantee that b is a "B". 31 // Use a type-check to guarantee that b is a "B".
32 if (b is B) { 32 if (b is B) {
33 Expect.equals(499, b.foo(498)); 33 Expect.equals(499, b.foo(498));
34 } 34 }
35 } 35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698