OLD | NEW |
(Empty) | |
| 1 dart_library.library('corelib/apply3_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__apply3_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const _interceptors = dart_sdk._interceptors; |
| 8 const mirrors = dart_sdk.mirrors; |
| 9 const dart = dart_sdk.dart; |
| 10 const dartx = dart_sdk.dartx; |
| 11 const expect$ = expect.expect; |
| 12 const apply3_test = Object.create(null); |
| 13 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c
ore.int)))(); |
| 14 let MapOfSymbol$dynamic = () => (MapOfSymbol$dynamic = dart.constFn(core.Map$(
core.Symbol, dart.dynamic)))(); |
| 15 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 16 apply3_test.F = dart.callableClass(function F(...args) { |
| 17 const self = this; |
| 18 function call(...args) { |
| 19 return self.call.apply(self, args); |
| 20 } |
| 21 call.__proto__ = this.__proto__; |
| 22 call.new.apply(call, args); |
| 23 return call; |
| 24 }, class F extends core.Object { |
| 25 call(p1) { |
| 26 if (p1 === void 0) p1 = null; |
| 27 return "call"; |
| 28 } |
| 29 noSuchMethod(invocation) { |
| 30 return "NSM"; |
| 31 } |
| 32 }); |
| 33 dart.setSignature(apply3_test.F, { |
| 34 methods: () => ({call: dart.definiteFunctionType(dart.dynamic, [], [dart.dyn
amic])}) |
| 35 }); |
| 36 apply3_test.G = dart.callableClass(function G(...args) { |
| 37 const self = this; |
| 38 function call(...args) { |
| 39 return self.call.apply(self, args); |
| 40 } |
| 41 call.__proto__ = this.__proto__; |
| 42 call.new.apply(call, args); |
| 43 return call; |
| 44 }, class G extends core.Object { |
| 45 call() { |
| 46 return '42'; |
| 47 } |
| 48 noSuchMethod(invocation) { |
| 49 return invocation; |
| 50 } |
| 51 }); |
| 52 dart.setSignature(apply3_test.G, { |
| 53 methods: () => ({call: dart.definiteFunctionType(dart.dynamic, [])}) |
| 54 }); |
| 55 apply3_test.H = dart.callableClass(function H(...args) { |
| 56 const self = this; |
| 57 function call(...args) { |
| 58 return self.call.apply(self, args); |
| 59 } |
| 60 call.__proto__ = this.__proto__; |
| 61 call.new.apply(call, args); |
| 62 return call; |
| 63 }, class H extends core.Object { |
| 64 call(required, opts) { |
| 65 let a = opts && 'a' in opts ? opts.a : null; |
| 66 return dart.dsend(required, '+', a); |
| 67 } |
| 68 }); |
| 69 dart.setSignature(apply3_test.H, { |
| 70 methods: () => ({call: dart.definiteFunctionType(dart.dynamic, [dart.dynamic
], {a: dart.dynamic})}) |
| 71 }); |
| 72 let const$; |
| 73 let const$0; |
| 74 apply3_test.main = function() { |
| 75 expect$.Expect.equals('call', core.Function.apply(new apply3_test.F(), [])); |
| 76 expect$.Expect.equals('call', core.Function.apply(new apply3_test.F(), JSArr
ayOfint().of([1]))); |
| 77 expect$.Expect.equals('NSM', core.Function.apply(new apply3_test.F(), JSArra
yOfint().of([1, 2]))); |
| 78 expect$.Expect.equals('NSM', core.Function.apply(new apply3_test.F(), JSArra
yOfint().of([1, 2, 3]))); |
| 79 let symbol = const$ || (const$ = dart.const(core.Symbol.new('a'))); |
| 80 let requiredParameters = JSArrayOfint().of([1]); |
| 81 let optionalParameters = core.Map.new(); |
| 82 optionalParameters[dartx.set](symbol, 42); |
| 83 let i = core.Invocation._check(core.Function.apply(new apply3_test.G(), requ
iredParameters, MapOfSymbol$dynamic()._check(optionalParameters))); |
| 84 expect$.Expect.equals(const$0 || (const$0 = dart.const(core.Symbol.new('call
'))), i.memberName); |
| 85 expect$.Expect.listEquals(requiredParameters, i.positionalArguments); |
| 86 expect$.Expect.mapEquals(optionalParameters, i.namedArguments); |
| 87 expect$.Expect.isTrue(i.isMethod); |
| 88 expect$.Expect.isFalse(i.isGetter); |
| 89 expect$.Expect.isFalse(i.isSetter); |
| 90 expect$.Expect.isFalse(i.isAccessor); |
| 91 requiredParameters[dartx.set](0, 42); |
| 92 optionalParameters[dartx.set](symbol, 12); |
| 93 expect$.Expect.listEquals(JSArrayOfint().of([1]), i.positionalArguments); |
| 94 expect$.Expect.mapEquals((() => { |
| 95 let _ = core.Map.new(); |
| 96 _[dartx.set](symbol, 42); |
| 97 return _; |
| 98 })(), i.namedArguments); |
| 99 let mirror = mirrors.reflect(new apply3_test.G()); |
| 100 let other = core.Invocation._check(mirror.delegate(i)); |
| 101 expect$.Expect.equals(i.memberName, other.memberName); |
| 102 expect$.Expect.listEquals(i.positionalArguments, other.positionalArguments); |
| 103 expect$.Expect.mapEquals(i.namedArguments, other.namedArguments); |
| 104 expect$.Expect.equals(i.isMethod, other.isMethod); |
| 105 expect$.Expect.equals(i.isGetter, other.isGetter); |
| 106 expect$.Expect.equals(i.isSetter, other.isSetter); |
| 107 expect$.Expect.equals(i.isAccessor, other.isAccessor); |
| 108 expect$.Expect.equals(43, new apply3_test.H().call(1, {a: 42})); |
| 109 expect$.Expect.equals(43, core.Function.apply(new apply3_test.H(), JSArrayOf
int().of([1]), (() => { |
| 110 let _ = MapOfSymbol$dynamic().new(); |
| 111 _[dartx.set](symbol, 42); |
| 112 return _; |
| 113 })())); |
| 114 mirror = mirrors.reflect(new apply3_test.H()); |
| 115 expect$.Expect.equals(43, mirror.delegate(i)); |
| 116 expect$.Expect.equals(43, mirror.delegate(other)); |
| 117 }; |
| 118 dart.fn(apply3_test.main, VoidTodynamic()); |
| 119 // Exports: |
| 120 exports.apply3_test = apply3_test; |
| 121 }); |
OLD | NEW |