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

Side by Side Diff: tests/html/js_typed_interop_type2_test.dart

Issue 2307883002: Fix type masks for js-interop types. (Closed)
Patch Set: Update status 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
(Empty)
1 import 'dart:html';
2 import 'package:js/js.dart';
3 import 'package:expect/expect.dart';
4
5 @JS()
6 @anonymous
7 class C {
8 final foo;
9
10 external factory C({foo});
11 }
12
13 @JS()
14 @anonymous
15 class D {
16 final foo;
17
18 external factory D({foo});
19 }
20
21 class F {
22 final foo;
23
24 F(this.foo);
25 }
26
27 @NoInline()
28 testA(A o) {
29 return o.foo;
30 }
31
32 @NoInline()
33 testC(C o) {
34 return o.foo;
35 }
36
37 @NoInline()
38 testF(F o) {
39 return o.foo;
40 }
41
42 void expectValueOrTypeError(f(), value) {
43 try {
44 String i = 0; // Test for checked mode.
45 Expect.equals(f(), value);
46 } on TypeError catch (error) {
47 Expect.throws(f, (ex) => ex is TypeError);
48 }
49 }
50
51 main() {
52 var d = new D(foo: 4);
53 var f = new F(6);
54 Expect.equals(testC(d), 4);
55 Expect.equals(testF(f), 6); /// 01: ok
56 }
57
58
OLDNEW
« no previous file with comments | « tests/html/js_typed_interop_type1_test.dart ('k') | tests/html/js_typed_interop_type3_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698