OLD | NEW |
1 //FAILED TO COMPILE | 1 dart_library.library('language/many_generic_instanceof_test', null, /* Imports *
/[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__many_generic_instanceof_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const dart = dart_sdk.dart; |
| 8 const dartx = dart_sdk.dartx; |
| 9 const expect$ = expect.expect; |
| 10 const many_generic_instanceof_test = Object.create(null); |
| 11 let Foo = () => (Foo = dart.constFn(many_generic_instanceof_test.Foo$()))(); |
| 12 let FooOfString = () => (FooOfString = dart.constFn(many_generic_instanceof_te
st.Foo$(core.String)))(); |
| 13 let ListOfObject = () => (ListOfObject = dart.constFn(core.List$(core.Object))
)(); |
| 14 let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))(); |
| 15 let ListOfnum = () => (ListOfnum = dart.constFn(core.List$(core.num)))(); |
| 16 let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String))
)(); |
| 17 let FooOfList = () => (FooOfList = dart.constFn(many_generic_instanceof_test.F
oo$(core.List)))(); |
| 18 let FooOfListOfObject = () => (FooOfListOfObject = dart.constFn(many_generic_i
nstanceof_test.Foo$(ListOfObject())))(); |
| 19 let FooOfListOfint = () => (FooOfListOfint = dart.constFn(many_generic_instanc
eof_test.Foo$(ListOfint())))(); |
| 20 let FooOfListOfnum = () => (FooOfListOfnum = dart.constFn(many_generic_instanc
eof_test.Foo$(ListOfnum())))(); |
| 21 let FooOfListOfString = () => (FooOfListOfString = dart.constFn(many_generic_i
nstanceof_test.Foo$(ListOfString())))(); |
| 22 let FooOfObject = () => (FooOfObject = dart.constFn(many_generic_instanceof_te
st.Foo$(core.Object)))(); |
| 23 let FooOfint = () => (FooOfint = dart.constFn(many_generic_instanceof_test.Foo
$(core.int)))(); |
| 24 let FooOfnum = () => (FooOfnum = dart.constFn(many_generic_instanceof_test.Foo
$(core.num)))(); |
| 25 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 26 many_generic_instanceof_test.ManyGenericInstanceofTest = class ManyGenericInst
anceofTest extends core.Object { |
| 27 static testMain() { |
| 28 for (let i = 0; i < 20; i++) { |
| 29 many_generic_instanceof_test.GenericInstanceof.testMain(); |
| 30 } |
| 31 } |
| 32 }; |
| 33 dart.setSignature(many_generic_instanceof_test.ManyGenericInstanceofTest, { |
| 34 statics: () => ({testMain: dart.definiteFunctionType(dart.dynamic, [])}), |
| 35 names: ['testMain'] |
| 36 }); |
| 37 many_generic_instanceof_test.main = function() { |
| 38 many_generic_instanceof_test.ManyGenericInstanceofTest.testMain(); |
| 39 }; |
| 40 dart.fn(many_generic_instanceof_test.main, VoidTodynamic()); |
| 41 many_generic_instanceof_test.Foo$ = dart.generic(T => { |
| 42 let ListOfT = () => (ListOfT = dart.constFn(core.List$(T)))(); |
| 43 class Foo extends core.Object { |
| 44 new() { |
| 45 } |
| 46 isT(x) { |
| 47 return T.is(x); |
| 48 } |
| 49 isListT(x) { |
| 50 return ListOfT().is(x); |
| 51 } |
| 52 } |
| 53 dart.addTypeTests(Foo); |
| 54 dart.setSignature(Foo, { |
| 55 constructors: () => ({new: dart.definiteFunctionType(many_generic_instance
of_test.Foo$(T), [])}), |
| 56 methods: () => ({ |
| 57 isT: dart.definiteFunctionType(core.bool, [dart.dynamic]), |
| 58 isListT: dart.definiteFunctionType(core.bool, [dart.dynamic]) |
| 59 }) |
| 60 }); |
| 61 return Foo; |
| 62 }); |
| 63 many_generic_instanceof_test.Foo = Foo(); |
| 64 many_generic_instanceof_test.GenericInstanceof = class GenericInstanceof exten
ds core.Object { |
| 65 static testMain() { |
| 66 let fooObject = new (FooOfString())(); |
| 67 expect$.Expect.equals(true, fooObject.isT("string")); |
| 68 expect$.Expect.equals(false, fooObject.isT(1)); |
| 69 let fooString = new (FooOfString())(); |
| 70 expect$.Expect.equals(true, fooString.isT("string")); |
| 71 expect$.Expect.equals(false, fooString.isT(1)); |
| 72 { |
| 73 let foo = new (FooOfString())(); |
| 74 expect$.Expect.equals(true, foo.isT("string")); |
| 75 expect$.Expect.equals(false, foo.isT(1)); |
| 76 } |
| 77 { |
| 78 let foo = new many_generic_instanceof_test.Foo(); |
| 79 expect$.Expect.equals(true, foo.isT(core.List.new(5))); |
| 80 expect$.Expect.equals(true, foo.isT(ListOfObject().new(5))); |
| 81 expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); |
| 82 expect$.Expect.equals(true, foo.isT(ListOfnum().new(5))); |
| 83 expect$.Expect.equals(true, foo.isT(ListOfString().new(5))); |
| 84 } |
| 85 { |
| 86 let foo = new (FooOfList())(); |
| 87 expect$.Expect.equals(true, foo.isT(core.List.new(5))); |
| 88 expect$.Expect.equals(true, foo.isT(ListOfObject().new(5))); |
| 89 expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); |
| 90 expect$.Expect.equals(true, foo.isT(ListOfnum().new(5))); |
| 91 expect$.Expect.equals(true, foo.isT(ListOfString().new(5))); |
| 92 } |
| 93 { |
| 94 let foo = new (FooOfListOfObject())(); |
| 95 expect$.Expect.equals(true, foo.isT(core.List.new(5))); |
| 96 expect$.Expect.equals(true, foo.isT(ListOfObject().new(5))); |
| 97 expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); |
| 98 expect$.Expect.equals(true, foo.isT(ListOfnum().new(5))); |
| 99 expect$.Expect.equals(true, foo.isT(ListOfString().new(5))); |
| 100 } |
| 101 { |
| 102 let foo = new (FooOfListOfint())(); |
| 103 expect$.Expect.equals(true, foo.isT(core.List.new(5))); |
| 104 expect$.Expect.equals(false, foo.isT(ListOfObject().new(5))); |
| 105 expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); |
| 106 expect$.Expect.equals(false, foo.isT(ListOfnum().new(5))); |
| 107 expect$.Expect.equals(false, foo.isT(ListOfString().new(5))); |
| 108 } |
| 109 { |
| 110 let foo = new (FooOfListOfnum())(); |
| 111 expect$.Expect.equals(true, foo.isT(core.List.new(5))); |
| 112 expect$.Expect.equals(false, foo.isT(ListOfObject().new(5))); |
| 113 expect$.Expect.equals(true, foo.isT(ListOfint().new(5))); |
| 114 expect$.Expect.equals(true, foo.isT(ListOfnum().new(5))); |
| 115 expect$.Expect.equals(false, foo.isT(ListOfString().new(5))); |
| 116 } |
| 117 { |
| 118 let foo = new (FooOfListOfString())(); |
| 119 expect$.Expect.equals(true, foo.isT(core.List.new(5))); |
| 120 expect$.Expect.equals(false, foo.isT(ListOfObject().new(5))); |
| 121 expect$.Expect.equals(false, foo.isT(ListOfint().new(5))); |
| 122 expect$.Expect.equals(false, foo.isT(ListOfnum().new(5))); |
| 123 expect$.Expect.equals(true, foo.isT(ListOfString().new(5))); |
| 124 } |
| 125 { |
| 126 let foo = new many_generic_instanceof_test.Foo(); |
| 127 expect$.Expect.equals(true, foo.isListT(core.List.new(5))); |
| 128 expect$.Expect.equals(true, foo.isListT(ListOfObject().new(5))); |
| 129 expect$.Expect.equals(true, foo.isListT(ListOfint().new(5))); |
| 130 expect$.Expect.equals(true, foo.isListT(ListOfnum().new(5))); |
| 131 expect$.Expect.equals(true, foo.isListT(ListOfString().new(5))); |
| 132 } |
| 133 { |
| 134 let foo = new (FooOfObject())(); |
| 135 expect$.Expect.equals(true, foo.isListT(core.List.new(5))); |
| 136 expect$.Expect.equals(true, foo.isListT(ListOfObject().new(5))); |
| 137 expect$.Expect.equals(true, foo.isListT(ListOfint().new(5))); |
| 138 expect$.Expect.equals(true, foo.isListT(ListOfnum().new(5))); |
| 139 expect$.Expect.equals(true, foo.isListT(ListOfString().new(5))); |
| 140 } |
| 141 { |
| 142 let foo = new (FooOfint())(); |
| 143 expect$.Expect.equals(true, foo.isListT(core.List.new(5))); |
| 144 expect$.Expect.equals(false, foo.isListT(ListOfObject().new(5))); |
| 145 expect$.Expect.equals(true, foo.isListT(ListOfint().new(5))); |
| 146 expect$.Expect.equals(false, foo.isListT(ListOfnum().new(5))); |
| 147 expect$.Expect.equals(false, foo.isListT(ListOfString().new(5))); |
| 148 } |
| 149 { |
| 150 let foo = new (FooOfnum())(); |
| 151 expect$.Expect.equals(true, foo.isListT(core.List.new(5))); |
| 152 expect$.Expect.equals(false, foo.isListT(ListOfObject().new(5))); |
| 153 expect$.Expect.equals(true, foo.isListT(ListOfint().new(5))); |
| 154 expect$.Expect.equals(true, foo.isListT(ListOfnum().new(5))); |
| 155 expect$.Expect.equals(false, foo.isListT(ListOfString().new(5))); |
| 156 } |
| 157 { |
| 158 let foo = new (FooOfString())(); |
| 159 expect$.Expect.equals(true, foo.isListT(core.List.new(5))); |
| 160 expect$.Expect.equals(false, foo.isListT(ListOfObject().new(5))); |
| 161 expect$.Expect.equals(false, foo.isListT(ListOfint().new(5))); |
| 162 expect$.Expect.equals(false, foo.isListT(ListOfnum().new(5))); |
| 163 expect$.Expect.equals(true, foo.isListT(ListOfString().new(5))); |
| 164 } |
| 165 } |
| 166 }; |
| 167 dart.setSignature(many_generic_instanceof_test.GenericInstanceof, { |
| 168 statics: () => ({testMain: dart.definiteFunctionType(dart.void, [])}), |
| 169 names: ['testMain'] |
| 170 }); |
| 171 // Exports: |
| 172 exports.many_generic_instanceof_test = many_generic_instanceof_test; |
| 173 }); |
OLD | NEW |