OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/constructor12_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__constructor12_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const _interceptors = dart_sdk._interceptors; |
| 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; |
| 10 const expect$ = expect.expect; |
| 11 const constructor12_test = Object.create(null); |
| 12 let A = () => (A = dart.constFn(constructor12_test.A$()))(); |
| 13 let AOfint = () => (AOfint = dart.constFn(constructor12_test.A$(core.int)))(); |
| 14 let AOfString = () => (AOfString = dart.constFn(constructor12_test.A$(core.Str
ing)))(); |
| 15 let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))(); |
| 16 let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String))
)(); |
| 17 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 18 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 19 constructor12_test.B = class B extends core.Object { |
| 20 new(z) { |
| 21 this.z = z; |
| 22 } |
| 23 foo() { |
| 24 return this.z; |
| 25 } |
| 26 }; |
| 27 dart.setSignature(constructor12_test.B, { |
| 28 constructors: () => ({new: dart.definiteFunctionType(constructor12_test.B, [
dart.dynamic])}), |
| 29 methods: () => ({foo: dart.definiteFunctionType(dart.dynamic, [])}) |
| 30 }); |
| 31 constructor12_test.A$ = dart.generic(T => { |
| 32 let JSArrayOfT = () => (JSArrayOfT = dart.constFn(_interceptors.JSArray$(T))
)(); |
| 33 class A extends constructor12_test.B { |
| 34 new(p) { |
| 35 this.captured = dart.fn(() => p, VoidTodynamic()); |
| 36 this.captured2 = null; |
| 37 this.typedList = null; |
| 38 super.new((() => { |
| 39 let x = p; |
| 40 p = dart.dsend(x, '+', 1); |
| 41 return x; |
| 42 })()); |
| 43 try { |
| 44 } catch (e) { |
| 45 } |
| 46 |
| 47 this.captured2 = dart.fn(() => (() => { |
| 48 let x = p; |
| 49 p = dart.dsend(x, '+', 1); |
| 50 return x; |
| 51 })(), VoidTodynamic()); |
| 52 this.typedList = JSArrayOfT().of([]); |
| 53 } |
| 54 foo() { |
| 55 return dart.dcall(this.captured); |
| 56 } |
| 57 bar() { |
| 58 return dart.dcall(this.captured2); |
| 59 } |
| 60 } |
| 61 dart.addTypeTests(A); |
| 62 dart.setSignature(A, { |
| 63 constructors: () => ({new: dart.definiteFunctionType(constructor12_test.A$
(T), [dart.dynamic])}), |
| 64 methods: () => ({bar: dart.definiteFunctionType(dart.dynamic, [])}) |
| 65 }); |
| 66 return A; |
| 67 }); |
| 68 constructor12_test.A = A(); |
| 69 constructor12_test.confuse = function(x) { |
| 70 return x; |
| 71 }; |
| 72 dart.fn(constructor12_test.confuse, dynamicTodynamic()); |
| 73 constructor12_test.main = function() { |
| 74 let a = constructor12_test.confuse(new (AOfint())(1)); |
| 75 let a2 = constructor12_test.confuse(new constructor12_test.A(2)); |
| 76 let b = constructor12_test.confuse(new constructor12_test.B(3)); |
| 77 expect$.Expect.equals(2, dart.dsend(a, 'foo')); |
| 78 expect$.Expect.equals(3, dart.dsend(a2, 'foo')); |
| 79 expect$.Expect.equals(3, dart.dsend(b, 'foo')); |
| 80 expect$.Expect.equals(1, dart.dload(a, 'z')); |
| 81 expect$.Expect.equals(2, dart.dload(a2, 'z')); |
| 82 expect$.Expect.equals(3, dart.dload(b, 'z')); |
| 83 expect$.Expect.isTrue(AOfint().is(a)); |
| 84 expect$.Expect.isFalse(AOfString().is(a)); |
| 85 expect$.Expect.isTrue(AOfint().is(a2)); |
| 86 expect$.Expect.isTrue(AOfString().is(a2)); |
| 87 expect$.Expect.equals(2, dart.dsend(a, 'bar')); |
| 88 expect$.Expect.equals(3, dart.dsend(a2, 'bar')); |
| 89 expect$.Expect.equals(3, dart.dsend(a, 'foo')); |
| 90 expect$.Expect.equals(4, dart.dsend(a2, 'foo')); |
| 91 expect$.Expect.equals(0, dart.dload(dart.dload(a, 'typedList'), 'length')); |
| 92 expect$.Expect.equals(0, dart.dload(dart.dload(a2, 'typedList'), 'length')); |
| 93 dart.dsend(dart.dload(a, 'typedList'), 'add', 499); |
| 94 expect$.Expect.equals(1, dart.dload(dart.dload(a, 'typedList'), 'length')); |
| 95 expect$.Expect.equals(0, dart.dload(dart.dload(a2, 'typedList'), 'length')); |
| 96 expect$.Expect.isTrue(ListOfint().is(dart.dload(a, 'typedList'))); |
| 97 expect$.Expect.isTrue(ListOfint().is(dart.dload(a2, 'typedList'))); |
| 98 expect$.Expect.isFalse(ListOfString().is(dart.dload(a, 'typedList'))); |
| 99 expect$.Expect.isTrue(ListOfString().is(dart.dload(a2, 'typedList'))); |
| 100 }; |
| 101 dart.fn(constructor12_test.main, VoidTodynamic()); |
| 102 // Exports: |
| 103 exports.constructor12_test = constructor12_test; |
| 104 }); |
OLD | NEW |