OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/call_through_null_getter_test', null, /* Imports
*/[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__call_through_null_getter_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 call_through_null_getter_test = Object.create(null); |
| 11 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.functionType(dart.void,
[])))(); |
| 12 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 13 let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionT
ype(core.bool, [dart.dynamic])))(); |
| 14 call_through_null_getter_test.TOP_LEVEL_NULL = null; |
| 15 call_through_null_getter_test.topLevel = null; |
| 16 call_through_null_getter_test.CallThroughNullGetterTest = class CallThroughNul
lGetterTest extends core.Object { |
| 17 static testMain() { |
| 18 call_through_null_getter_test.CallThroughNullGetterTest.testTopLevel(); |
| 19 call_through_null_getter_test.CallThroughNullGetterTest.testField(); |
| 20 call_through_null_getter_test.CallThroughNullGetterTest.testGetter(); |
| 21 call_through_null_getter_test.CallThroughNullGetterTest.testMethod(); |
| 22 } |
| 23 static testTopLevel() { |
| 24 call_through_null_getter_test.topLevel = null; |
| 25 call_through_null_getter_test.CallThroughNullGetterTest.expectThrowsNoSuch
MethodError(dart.fn(() => { |
| 26 dart.dcall(call_through_null_getter_test.topLevel); |
| 27 }, VoidTodynamic())); |
| 28 call_through_null_getter_test.CallThroughNullGetterTest.expectThrowsNoSuch
MethodError(dart.fn(() => { |
| 29 dart.dcall(call_through_null_getter_test.topLevel); |
| 30 }, VoidTodynamic())); |
| 31 call_through_null_getter_test.CallThroughNullGetterTest.expectThrowsNoSuch
MethodError(dart.fn(() => { |
| 32 dart.dcall(call_through_null_getter_test.TOP_LEVEL_NULL); |
| 33 }, VoidTodynamic())); |
| 34 call_through_null_getter_test.CallThroughNullGetterTest.expectThrowsNoSuch
MethodError(dart.fn(() => { |
| 35 dart.dcall(call_through_null_getter_test.TOP_LEVEL_NULL); |
| 36 }, VoidTodynamic())); |
| 37 } |
| 38 static testField() { |
| 39 let a = new call_through_null_getter_test.A(); |
| 40 a.field = null; |
| 41 call_through_null_getter_test.CallThroughNullGetterTest.expectThrowsNoSuch
MethodError(dart.fn(() => { |
| 42 dart.dsend(a, 'field'); |
| 43 }, VoidTodynamic())); |
| 44 call_through_null_getter_test.CallThroughNullGetterTest.expectThrowsNoSuch
MethodError(dart.fn(() => { |
| 45 dart.dcall(a.field); |
| 46 }, VoidTodynamic())); |
| 47 } |
| 48 static testGetter() { |
| 49 let a = new call_through_null_getter_test.A(); |
| 50 a.field = null; |
| 51 call_through_null_getter_test.CallThroughNullGetterTest.expectThrowsNoSuch
MethodError(dart.fn(() => { |
| 52 dart.dsend(a, 'getter'); |
| 53 }, VoidTodynamic())); |
| 54 call_through_null_getter_test.CallThroughNullGetterTest.expectThrowsNoSuch
MethodError(dart.fn(() => { |
| 55 dart.dcall(a.getter); |
| 56 }, VoidTodynamic())); |
| 57 } |
| 58 static testMethod() { |
| 59 let a = new call_through_null_getter_test.A(); |
| 60 a.field = null; |
| 61 call_through_null_getter_test.CallThroughNullGetterTest.expectThrowsNoSuch
MethodError(dart.fn(() => { |
| 62 dart.dcall(a.method()); |
| 63 }, VoidTodynamic())); |
| 64 } |
| 65 static expectThrowsNoSuchMethodError(fn) { |
| 66 expect$.Expect.throws(VoidTovoid()._check(fn), dart.fn(e => core.NoSuchMet
hodError.is(e), dynamicTobool()), "Should throw NoSuchMethodError"); |
| 67 } |
| 68 }; |
| 69 dart.setSignature(call_through_null_getter_test.CallThroughNullGetterTest, { |
| 70 statics: () => ({ |
| 71 testMain: dart.definiteFunctionType(dart.void, []), |
| 72 testTopLevel: dart.definiteFunctionType(dart.void, []), |
| 73 testField: dart.definiteFunctionType(dart.void, []), |
| 74 testGetter: dart.definiteFunctionType(dart.void, []), |
| 75 testMethod: dart.definiteFunctionType(dart.void, []), |
| 76 expectThrowsNoSuchMethodError: dart.definiteFunctionType(dart.void, [dart.
dynamic]) |
| 77 }), |
| 78 names: ['testMain', 'testTopLevel', 'testField', 'testGetter', 'testMethod',
'expectThrowsNoSuchMethodError'] |
| 79 }); |
| 80 call_through_null_getter_test.A = class A extends core.Object { |
| 81 new() { |
| 82 this.field = null; |
| 83 } |
| 84 get getter() { |
| 85 return this.field; |
| 86 } |
| 87 method() { |
| 88 return this.field; |
| 89 } |
| 90 }; |
| 91 dart.setSignature(call_through_null_getter_test.A, { |
| 92 constructors: () => ({new: dart.definiteFunctionType(call_through_null_gette
r_test.A, [])}), |
| 93 methods: () => ({method: dart.definiteFunctionType(dart.dynamic, [])}) |
| 94 }); |
| 95 call_through_null_getter_test.main = function() { |
| 96 call_through_null_getter_test.CallThroughNullGetterTest.testMain(); |
| 97 }; |
| 98 dart.fn(call_through_null_getter_test.main, VoidTodynamic()); |
| 99 // Exports: |
| 100 exports.call_through_null_getter_test = call_through_null_getter_test; |
| 101 }); |
OLD | NEW |