OLD | NEW |
| (Empty) |
1 dart_library.library('misc', null, /* Imports */[ | |
2 'dart_sdk' | |
3 ], function(exports, dart_sdk) { | |
4 'use strict'; | |
5 const core = dart_sdk.core; | |
6 const dart = dart_sdk.dart; | |
7 const dartx = dart_sdk.dartx; | |
8 const misc = Object.create(null); | |
9 misc._Uninitialized = class _Uninitialized extends core.Object { | |
10 new() { | |
11 } | |
12 }; | |
13 dart.setSignature(misc._Uninitialized, { | |
14 constructors: () => ({new: [misc._Uninitialized, []]}) | |
15 }); | |
16 misc.UNINITIALIZED = dart.const(new misc._Uninitialized()); | |
17 misc.Generic$ = dart.generic(T => { | |
18 class Generic extends core.Object { | |
19 get type() { | |
20 return dart.wrapType(misc.Generic); | |
21 } | |
22 m() { | |
23 return core.print(dart.wrapType(T)); | |
24 } | |
25 } | |
26 dart.setSignature(Generic, { | |
27 methods: () => ({m: [dart.dynamic, []]}) | |
28 }); | |
29 return Generic; | |
30 }); | |
31 misc.Generic = misc.Generic$(); | |
32 misc.Base = class Base extends core.Object { | |
33 new() { | |
34 this.x = 1; | |
35 this.y = 2; | |
36 } | |
37 ['=='](obj) { | |
38 return dart.is(obj, misc.Base) && obj.x == this.x && obj.y == this.y; | |
39 } | |
40 }; | |
41 misc.Derived = class Derived extends core.Object { | |
42 new() { | |
43 this.z = 3; | |
44 } | |
45 ['=='](obj) { | |
46 return dart.is(obj, misc.Derived) && obj.z == this.z && super['=='](obj); | |
47 } | |
48 }; | |
49 misc._isWhitespace = function(ch) { | |
50 return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t'; | |
51 }; | |
52 dart.fn(misc._isWhitespace, core.bool, [core.String]); | |
53 misc.expr = 'foo'; | |
54 misc._escapeMap = dart.const(dart.map({'\n': '\\n', '\r': '\\r', '\f': '\\f',
'\b': '\\b', '\t': '\\t', '\v': '\\v', '': '\\x7F', [`\${${misc.expr}}`]: ''}))
; | |
55 misc.main = function() { | |
56 core.print(dart.toString(1)); | |
57 core.print(dart.toString(1.0)); | |
58 core.print(dart.toString(1.1)); | |
59 let x = 42; | |
60 core.print(dart.equals(x, dart.wrapType(dart.dynamic))); | |
61 core.print(dart.equals(x, dart.wrapType(misc.Generic))); | |
62 core.print(new (misc.Generic$(core.int))().type); | |
63 core.print(dart.equals(new misc.Derived(), new misc.Derived())); | |
64 new (misc.Generic$(core.int))().m(); | |
65 }; | |
66 dart.fn(misc.main); | |
67 // Exports: | |
68 exports.misc = misc; | |
69 }); | |
OLD | NEW |