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