OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/fast_method_extraction_test', null, /* Imports */
[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__fast_method_extraction_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 fast_method_extraction_test = Object.create(null); |
| 11 let C = () => (C = dart.constFn(fast_method_extraction_test.C$()))(); |
| 12 let COfX = () => (COfX = dart.constFn(fast_method_extraction_test.C$(fast_meth
od_extraction_test.X)))(); |
| 13 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 14 let dynamicAnddynamicTodynamic = () => (dynamicAnddynamicTodynamic = dart.cons
tFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))(); |
| 15 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 16 fast_method_extraction_test.A = class A extends core.Object { |
| 17 new(f) { |
| 18 this.f = f; |
| 19 } |
| 20 foo() { |
| 21 return 40 + dart.notNull(core.num._check(this.f)); |
| 22 } |
| 23 }; |
| 24 dart.setSignature(fast_method_extraction_test.A, { |
| 25 constructors: () => ({new: dart.definiteFunctionType(fast_method_extraction_
test.A, [dart.dynamic])}), |
| 26 methods: () => ({foo: dart.definiteFunctionType(dart.dynamic, [])}) |
| 27 }); |
| 28 fast_method_extraction_test.B = class B extends core.Object { |
| 29 new(f) { |
| 30 this.f = f; |
| 31 } |
| 32 foo() { |
| 33 return -40 - dart.notNull(core.num._check(this.f)); |
| 34 } |
| 35 }; |
| 36 dart.setSignature(fast_method_extraction_test.B, { |
| 37 constructors: () => ({new: dart.definiteFunctionType(fast_method_extraction_
test.B, [dart.dynamic])}), |
| 38 methods: () => ({foo: dart.definiteFunctionType(dart.dynamic, [])}) |
| 39 }); |
| 40 fast_method_extraction_test.X = class X extends core.Object {}; |
| 41 fast_method_extraction_test.C$ = dart.generic(T => { |
| 42 class C extends core.Object { |
| 43 foo(v) { |
| 44 return T.is(v); |
| 45 } |
| 46 } |
| 47 dart.addTypeTests(C); |
| 48 dart.setSignature(C, { |
| 49 methods: () => ({foo: dart.definiteFunctionType(dart.dynamic, [dart.dynami
c])}) |
| 50 }); |
| 51 return C; |
| 52 }); |
| 53 fast_method_extraction_test.C = C(); |
| 54 fast_method_extraction_test.ChaA = class ChaA extends core.Object { |
| 55 new(magic) { |
| 56 this.magic = magic; |
| 57 } |
| 58 foo() { |
| 59 expect$.Expect.isTrue(fast_method_extraction_test.ChaA.is(this)); |
| 60 expect$.Expect.equals("magicA", this.magic); |
| 61 return "A"; |
| 62 } |
| 63 bar() { |
| 64 return dart.bind(this, 'foo'); |
| 65 } |
| 66 }; |
| 67 dart.setSignature(fast_method_extraction_test.ChaA, { |
| 68 constructors: () => ({new: dart.definiteFunctionType(fast_method_extraction_
test.ChaA, [dart.dynamic])}), |
| 69 methods: () => ({ |
| 70 foo: dart.definiteFunctionType(dart.dynamic, []), |
| 71 bar: dart.definiteFunctionType(dart.dynamic, []) |
| 72 }) |
| 73 }); |
| 74 fast_method_extraction_test.ChaB = class ChaB extends fast_method_extraction_t
est.ChaA { |
| 75 new(magic) { |
| 76 super.new(magic); |
| 77 } |
| 78 foo() { |
| 79 expect$.Expect.isTrue(fast_method_extraction_test.ChaB.is(this)); |
| 80 expect$.Expect.equals("magicB", this.magic); |
| 81 return "B"; |
| 82 } |
| 83 }; |
| 84 dart.setSignature(fast_method_extraction_test.ChaB, { |
| 85 constructors: () => ({new: dart.definiteFunctionType(fast_method_extraction_
test.ChaB, [dart.dynamic])}) |
| 86 }); |
| 87 fast_method_extraction_test.mono = function(a) { |
| 88 let f = dart.dload(a, 'foo'); |
| 89 return dart.dcall(f); |
| 90 }; |
| 91 dart.fn(fast_method_extraction_test.mono, dynamicTodynamic()); |
| 92 fast_method_extraction_test.poly = function(a) { |
| 93 let f = dart.dload(a, 'foo'); |
| 94 return dart.dcall(f); |
| 95 }; |
| 96 dart.fn(fast_method_extraction_test.poly, dynamicTodynamic()); |
| 97 fast_method_extraction_test.types = function(a, b) { |
| 98 let f = dart.dload(a, 'foo'); |
| 99 expect$.Expect.isTrue(dart.dcall(f, b)); |
| 100 }; |
| 101 dart.fn(fast_method_extraction_test.types, dynamicAnddynamicTodynamic()); |
| 102 fast_method_extraction_test.cha = function(a) { |
| 103 let f = dart.dsend(a, 'bar'); |
| 104 return dart.dcall(f); |
| 105 }; |
| 106 dart.fn(fast_method_extraction_test.cha, dynamicTodynamic()); |
| 107 fast_method_extraction_test.extractFromNull = function() { |
| 108 let f = dart.toString(null); |
| 109 expect$.Expect.equals("null", dart.dcall(f)); |
| 110 }; |
| 111 dart.fn(fast_method_extraction_test.extractFromNull, VoidTodynamic()); |
| 112 fast_method_extraction_test.main = function() { |
| 113 let a = new fast_method_extraction_test.A(2); |
| 114 let b = new fast_method_extraction_test.B(2); |
| 115 for (let i = 0; i < 20; i++) { |
| 116 expect$.Expect.equals(42, fast_method_extraction_test.mono(a)); |
| 117 } |
| 118 for (let i = 0; i < 20; i++) { |
| 119 expect$.Expect.equals(42, fast_method_extraction_test.poly(a)); |
| 120 expect$.Expect.equals(-42, fast_method_extraction_test.poly(b)); |
| 121 } |
| 122 let c = new (COfX())(); |
| 123 let x = new fast_method_extraction_test.X(); |
| 124 for (let i = 0; i < 20; i++) { |
| 125 fast_method_extraction_test.types(c, x); |
| 126 } |
| 127 let chaA = new fast_method_extraction_test.ChaA("magicA"); |
| 128 for (let i = 0; i < 20; i++) { |
| 129 expect$.Expect.equals("A", fast_method_extraction_test.cha(chaA)); |
| 130 } |
| 131 let chaB = new fast_method_extraction_test.ChaB("magicB"); |
| 132 for (let i = 0; i < 20; i++) { |
| 133 expect$.Expect.equals("B", fast_method_extraction_test.cha(chaB)); |
| 134 } |
| 135 for (let i = 0; i < 20; i++) { |
| 136 fast_method_extraction_test.extractFromNull(); |
| 137 } |
| 138 }; |
| 139 dart.fn(fast_method_extraction_test.main, VoidTodynamic()); |
| 140 // Exports: |
| 141 exports.fast_method_extraction_test = fast_method_extraction_test; |
| 142 }); |
OLD | NEW |