OLD | NEW |
1 dart_library.library('fieldtest', null, /* Imports */[ | 1 dart_library.library('fieldtest', null, /* Imports */[ |
2 'dart_sdk' | 2 'dart_sdk' |
3 ], function(exports, dart_sdk) { | 3 ], function(exports, dart_sdk) { |
4 'use strict'; | 4 'use strict'; |
5 const core = dart_sdk.core; | 5 const core = dart_sdk.core; |
6 const dart = dart_sdk.dart; | 6 const dart = dart_sdk.dart; |
7 const dartx = dart_sdk.dartx; | 7 const dartx = dart_sdk.dartx; |
8 const fieldtest = Object.create(null); | 8 const fieldtest = Object.create(null); |
9 fieldtest.A = class A extends core.Object { | 9 fieldtest.A = class A extends core.Object { |
10 A() { | 10 new() { |
11 this.x = 42; | 11 this.x = 42; |
12 } | 12 } |
13 }; | 13 }; |
14 fieldtest.B$ = dart.generic(T => { | 14 fieldtest.B$ = dart.generic(T => { |
15 class B extends core.Object { | 15 class B extends core.Object { |
16 B() { | 16 new() { |
17 this.x = null; | 17 this.x = null; |
18 this.y = null; | 18 this.y = null; |
19 this.z = null; | 19 this.z = null; |
20 } | 20 } |
21 } | 21 } |
22 return B; | 22 return B; |
23 }); | 23 }); |
24 fieldtest.B = fieldtest.B$(); | 24 fieldtest.B = fieldtest.B$(); |
25 fieldtest.foo = function(a) { | 25 fieldtest.foo = function(a) { |
26 core.print(a.x); | 26 core.print(a.x); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 set z(value) { | 58 set z(value) { |
59 fieldtest.y = dart.as(value, core.int); | 59 fieldtest.y = dart.as(value, core.int); |
60 } | 60 } |
61 }); | 61 }); |
62 fieldtest.BaseWithGetter = class BaseWithGetter extends core.Object { | 62 fieldtest.BaseWithGetter = class BaseWithGetter extends core.Object { |
63 get foo() { | 63 get foo() { |
64 return 1; | 64 return 1; |
65 } | 65 } |
66 }; | 66 }; |
67 fieldtest.Derived = class Derived extends fieldtest.BaseWithGetter { | 67 fieldtest.Derived = class Derived extends fieldtest.BaseWithGetter { |
68 Derived() { | 68 new() { |
69 this[foo] = 2; | 69 this[foo] = 2; |
70 this.bar = 3; | 70 this.bar = 3; |
71 } | 71 } |
72 get foo() { | 72 get foo() { |
73 return this[foo]; | 73 return this[foo]; |
74 } | 74 } |
75 set foo(value) { | 75 set foo(value) { |
76 this[foo] = value; | 76 this[foo] = value; |
77 } | 77 } |
78 }; | 78 }; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 return fieldtest.StaticFieldOrder2.b + 1; | 111 return fieldtest.StaticFieldOrder2.b + 1; |
112 }, | 112 }, |
113 get c() { | 113 get c() { |
114 return fieldtest.StaticFieldOrder2.d + 2; | 114 return fieldtest.StaticFieldOrder2.d + 2; |
115 }, | 115 }, |
116 get b() { | 116 get b() { |
117 return fieldtest.StaticFieldOrder2.c + 3; | 117 return fieldtest.StaticFieldOrder2.c + 3; |
118 } | 118 } |
119 }); | 119 }); |
120 fieldtest.MyEnum = class MyEnum extends core.Object { | 120 fieldtest.MyEnum = class MyEnum extends core.Object { |
121 MyEnum(index) { | 121 new(index) { |
122 this.index = index; | 122 this.index = index; |
123 } | 123 } |
124 toString() { | 124 toString() { |
125 return { | 125 return { |
126 0: "MyEnum.Val1", | 126 0: "MyEnum.Val1", |
127 1: "MyEnum.Val2", | 127 1: "MyEnum.Val2", |
128 2: "MyEnum.Val3", | 128 2: "MyEnum.Val3", |
129 3: "MyEnum.Val4" | 129 3: "MyEnum.Val4" |
130 }[this.index]; | 130 }[this.index]; |
131 } | 131 } |
132 }; | 132 }; |
133 fieldtest.MyEnum.Val1 = dart.const(new fieldtest.MyEnum(0)); | 133 fieldtest.MyEnum.Val1 = dart.const(new fieldtest.MyEnum(0)); |
134 fieldtest.MyEnum.Val2 = dart.const(new fieldtest.MyEnum(1)); | 134 fieldtest.MyEnum.Val2 = dart.const(new fieldtest.MyEnum(1)); |
135 fieldtest.MyEnum.Val3 = dart.const(new fieldtest.MyEnum(2)); | 135 fieldtest.MyEnum.Val3 = dart.const(new fieldtest.MyEnum(2)); |
136 fieldtest.MyEnum.Val4 = dart.const(new fieldtest.MyEnum(3)); | 136 fieldtest.MyEnum.Val4 = dart.const(new fieldtest.MyEnum(3)); |
137 fieldtest.MyEnum.values = dart.const(dart.list([fieldtest.MyEnum.Val1, fieldte
st.MyEnum.Val2, fieldtest.MyEnum.Val3, fieldtest.MyEnum.Val4], fieldtest.MyEnum)
); | 137 fieldtest.MyEnum.values = dart.const(dart.list([fieldtest.MyEnum.Val1, fieldte
st.MyEnum.Val2, fieldtest.MyEnum.Val3, fieldtest.MyEnum.Val4], fieldtest.MyEnum)
); |
138 fieldtest.main = function() { | 138 fieldtest.main = function() { |
139 let a = new fieldtest.A(); | 139 let a = new fieldtest.A(); |
140 fieldtest.foo(a); | 140 fieldtest.foo(a); |
141 fieldtest.bar(a); | 141 fieldtest.bar(a); |
142 core.print(fieldtest.baz(a)); | 142 core.print(fieldtest.baz(a)); |
143 core.print(new (fieldtest.Generic$(core.String))().foo(' world')); | 143 core.print(new (fieldtest.Generic$(core.String))().foo(' world')); |
144 core.print(fieldtest.MyEnum.values); | 144 core.print(fieldtest.MyEnum.values); |
145 }; | 145 }; |
146 dart.fn(fieldtest.main, dart.void, []); | 146 dart.fn(fieldtest.main, dart.void, []); |
147 // Exports: | 147 // Exports: |
148 exports.fieldtest = fieldtest; | 148 exports.fieldtest = fieldtest; |
149 }); | 149 }); |
OLD | NEW |