OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/parse_closures_in_initializers_test', null, /* Im
ports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__parse_closures_in_initializers_test(exports, dart_sdk, expect)
{ |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const _interceptors = dart_sdk._interceptors; |
| 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; |
| 10 const expect$ = expect.expect; |
| 11 const parse_closures_in_initializers_test = Object.create(null); |
| 12 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.functionType(dart
.dynamic, [])))(); |
| 13 let JSArrayOfVoidTodynamic = () => (JSArrayOfVoidTodynamic = dart.constFn(_int
erceptors.JSArray$(VoidTodynamic())))(); |
| 14 let VoidTodynamic$ = () => (VoidTodynamic$ = dart.constFn(dart.definiteFunctio
nType(dart.dynamic, [])))(); |
| 15 parse_closures_in_initializers_test.A = class A extends core.Object { |
| 16 static foo(f) { |
| 17 return dart.dcall(f); |
| 18 } |
| 19 parenthesized(y) { |
| 20 this.x = dart.fn(() => y, VoidTodynamic$()); |
| 21 } |
| 22 stringLiteral(y) { |
| 23 this.x = dart.str`**${dart.fn(() => y, VoidTodynamic$())}--`; |
| 24 } |
| 25 listLiteral(y) { |
| 26 this.x = JSArrayOfVoidTodynamic().of([dart.fn(() => y, VoidTodynamic$())])
; |
| 27 } |
| 28 mapLiteral(y) { |
| 29 this.x = dart.map({fun: dart.fn(() => y, VoidTodynamic$())}); |
| 30 } |
| 31 arg(y) { |
| 32 this.x = parse_closures_in_initializers_test.A.foo(dart.fn(() => y, VoidTo
dynamic$())); |
| 33 } |
| 34 }; |
| 35 dart.defineNamedConstructor(parse_closures_in_initializers_test.A, 'parenthesi
zed'); |
| 36 dart.defineNamedConstructor(parse_closures_in_initializers_test.A, 'stringLite
ral'); |
| 37 dart.defineNamedConstructor(parse_closures_in_initializers_test.A, 'listLitera
l'); |
| 38 dart.defineNamedConstructor(parse_closures_in_initializers_test.A, 'mapLiteral
'); |
| 39 dart.defineNamedConstructor(parse_closures_in_initializers_test.A, 'arg'); |
| 40 dart.setSignature(parse_closures_in_initializers_test.A, { |
| 41 constructors: () => ({ |
| 42 parenthesized: dart.definiteFunctionType(parse_closures_in_initializers_te
st.A, [dart.dynamic]), |
| 43 stringLiteral: dart.definiteFunctionType(parse_closures_in_initializers_te
st.A, [dart.dynamic]), |
| 44 listLiteral: dart.definiteFunctionType(parse_closures_in_initializers_test
.A, [dart.dynamic]), |
| 45 mapLiteral: dart.definiteFunctionType(parse_closures_in_initializers_test.
A, [dart.dynamic]), |
| 46 arg: dart.definiteFunctionType(parse_closures_in_initializers_test.A, [dar
t.dynamic]) |
| 47 }), |
| 48 statics: () => ({foo: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]
)}), |
| 49 names: ['foo'] |
| 50 }); |
| 51 parse_closures_in_initializers_test.main = function() { |
| 52 let a = null, f = null; |
| 53 a = new parse_closures_in_initializers_test.A.parenthesized(499); |
| 54 f = dart.dload(a, 'x'); |
| 55 expect$.Expect.isTrue(core.Function.is(f)); |
| 56 expect$.Expect.equals(499, dart.dcall(f)); |
| 57 a = new parse_closures_in_initializers_test.A.stringLiteral(42); |
| 58 expect$.Expect.isTrue(dart.dsend(dart.dload(a, 'x'), 'startsWith', "**")); |
| 59 expect$.Expect.isTrue(dart.dsend(dart.dload(a, 'x'), 'endsWith', "--")); |
| 60 a = new parse_closures_in_initializers_test.A.listLiteral(99); |
| 61 f = dart.dindex(dart.dload(a, 'x'), 0); |
| 62 expect$.Expect.isTrue(core.Function.is(f)); |
| 63 expect$.Expect.equals(99, dart.dcall(f)); |
| 64 a = new parse_closures_in_initializers_test.A.mapLiteral(314); |
| 65 f = dart.dindex(dart.dload(a, 'x'), "fun"); |
| 66 expect$.Expect.isTrue(core.Function.is(f)); |
| 67 expect$.Expect.equals(314, dart.dcall(f)); |
| 68 a = new parse_closures_in_initializers_test.A.arg(123); |
| 69 expect$.Expect.equals(123, dart.dload(a, 'x')); |
| 70 }; |
| 71 dart.fn(parse_closures_in_initializers_test.main, VoidTodynamic$()); |
| 72 // Exports: |
| 73 exports.parse_closures_in_initializers_test = parse_closures_in_initializers_t
est; |
| 74 }); |
OLD | NEW |