OLD | NEW |
1 dart_library.library('language/no_such_method_subtype_test', null, /* Imports */
[ | 1 dart_library.library('language/no_such_method_subtype_test', null, /* Imports */
[ |
2 'dart_sdk', | 2 'dart_sdk', |
3 'expect' | 3 'expect' |
4 ], function load__no_such_method_subtype_test(exports, dart_sdk, expect) { | 4 ], function load__no_such_method_subtype_test(exports, dart_sdk, expect) { |
5 'use strict'; | 5 'use strict'; |
6 const core = dart_sdk.core; | 6 const core = dart_sdk.core; |
7 const _interceptors = dart_sdk._interceptors; | 7 const _interceptors = dart_sdk._interceptors; |
8 const dart = dart_sdk.dart; | 8 const dart = dart_sdk.dart; |
9 const dartx = dart_sdk.dartx; | 9 const dartx = dart_sdk.dartx; |
10 const expect$ = expect.expect; | 10 const expect$ = expect.expect; |
11 const no_such_method_subtype_test = Object.create(null); | 11 const no_such_method_subtype_test = Object.create(null); |
12 let JSArrayOfA = () => (JSArrayOfA = dart.constFn(_interceptors.JSArray$(no_su
ch_method_subtype_test.A)))(); | 12 let JSArrayOfA = () => (JSArrayOfA = dart.constFn(_interceptors.JSArray$(no_su
ch_method_subtype_test.A)))(); |
13 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); | 13 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
14 no_such_method_subtype_test.A = class A extends core.Object { | 14 no_such_method_subtype_test.A = class A extends core.Object { |
15 foo() { | 15 foo() { |
16 return 42; | 16 return 42; |
17 } | 17 } |
18 }; | 18 }; |
19 dart.setSignature(no_such_method_subtype_test.A, { | 19 dart.setSignature(no_such_method_subtype_test.A, { |
20 methods: () => ({foo: dart.definiteFunctionType(dart.dynamic, [])}) | 20 methods: () => ({foo: dart.definiteFunctionType(dart.dynamic, [])}) |
21 }); | 21 }); |
22 no_such_method_subtype_test.B = class B extends core.Object { | 22 no_such_method_subtype_test.B = class B extends core.Object { |
23 noSuchMethod(im) { | 23 noSuchMethod(im) { |
24 return 84; | 24 return 84; |
25 } | 25 } |
26 foo() { | 26 foo(...args) { |
27 return this.noSuchMethod(new dart.InvocationImpl('foo', [], {isMethod: tru
e})); | 27 return this.noSuchMethod(new dart.InvocationImpl('foo', args, {isMethod: t
rue})); |
28 } | 28 } |
29 }; | 29 }; |
30 no_such_method_subtype_test.B[dart.implements] = () => [no_such_method_subtype
_test.A]; | 30 no_such_method_subtype_test.B[dart.implements] = () => [no_such_method_subtype
_test.A]; |
31 no_such_method_subtype_test.main = function() { | 31 no_such_method_subtype_test.main = function() { |
32 let a = JSArrayOfA().of([new no_such_method_subtype_test.A(), new no_such_me
thod_subtype_test.B()]); | 32 let a = JSArrayOfA().of([new no_such_method_subtype_test.A(), new no_such_me
thod_subtype_test.B()]); |
33 let b = a[dartx.get](1); | 33 let b = a[dartx.get](1); |
34 if (no_such_method_subtype_test.A.is(b)) { | 34 if (no_such_method_subtype_test.A.is(b)) { |
35 expect$.Expect.equals(84, b.foo()); | 35 expect$.Expect.equals(84, b.foo()); |
36 return; | 36 return; |
37 } | 37 } |
38 expect$.Expect.fail('Should not be here'); | 38 expect$.Expect.fail('Should not be here'); |
39 }; | 39 }; |
40 dart.fn(no_such_method_subtype_test.main, VoidTodynamic()); | 40 dart.fn(no_such_method_subtype_test.main, VoidTodynamic()); |
41 // Exports: | 41 // Exports: |
42 exports.no_such_method_subtype_test = no_such_method_subtype_test; | 42 exports.no_such_method_subtype_test = no_such_method_subtype_test; |
43 }); | 43 }); |
OLD | NEW |