OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/const_locals_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__const_locals_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 const_locals_test = Object.create(null); |
| 11 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 12 const_locals_test.N = 8; |
| 13 const_locals_test.ConstFoo = class ConstFoo extends core.Object { |
| 14 new(x) { |
| 15 this.x = x; |
| 16 } |
| 17 }; |
| 18 dart.setSignature(const_locals_test.ConstFoo, { |
| 19 constructors: () => ({new: dart.definiteFunctionType(const_locals_test.Const
Foo, [dart.dynamic])}) |
| 20 }); |
| 21 let const$; |
| 22 let const$0; |
| 23 let const$1; |
| 24 const_locals_test.main = function() { |
| 25 let MIN = 2 - 1; |
| 26 let MAX = const_locals_test.N * 2; |
| 27 let MASK = (1)[dartx['<<']](MAX - MIN + 1) - 1; |
| 28 expect$.Expect.equals(1, MIN); |
| 29 expect$.Expect.equals(16, MAX); |
| 30 expect$.Expect.equals(65535, MASK); |
| 31 let s = dart.str`MIN = ${MIN} MAX = ${MAX} MASK = ${MASK}`; |
| 32 expect$.Expect.identical(s, dart.str`MIN = ${MIN} MAX = ${MAX} MASK = ${MA
SK}`); |
| 33 expect$.Expect.equals("MIN = 1 MAX = 16 MASK = 65535", s); |
| 34 let cf1 = const$ || (const$ = dart.const(new const_locals_test.ConstFoo(MASK
))); |
| 35 let cf2 = const$0 || (const$0 = dart.const(new const_locals_test.ConstFoo(s)
)); |
| 36 let cf3 = const$1 || (const$1 = dart.const(new const_locals_test.ConstFoo(da
rt.str`MIN = ${MIN} MAX = ${MAX} MASK = ${MASK}`))); |
| 37 expect$.Expect.identical(cf2, cf3); |
| 38 expect$.Expect.isFalse(core.identical(cf2, cf1)); |
| 39 }; |
| 40 dart.fn(const_locals_test.main, VoidTodynamic()); |
| 41 // Exports: |
| 42 exports.const_locals_test = const_locals_test; |
| 43 }); |
OLD | NEW |