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