OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // See inspector.txt for expected behavior. | 5 // See inspector.txt for expected behavior. |
6 | 6 |
7 library manual_inspector_test; | 7 library manual_inspector_test; |
8 | 8 |
9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
10 import 'dart:mirrors'; | 10 import 'dart:mirrors'; |
11 import 'dart:developer'; | 11 import 'dart:developer'; |
12 import 'dart:typed_data'; | 12 import 'dart:typed_data'; |
13 | 13 |
14 part 'inspector_part.dart'; | 14 part 'inspector_part.dart'; |
15 | 15 |
16 var libraryField; | 16 var libraryField; |
17 var node; | 17 var node; |
18 var uninitialized = new Object(); | 18 var uninitialized = new Object(); |
19 | 19 |
20 extractPrivateField(obj, name) { | 20 extractPrivateField(obj, name) { |
21 return reflect(obj).getField(MirrorSystem.getSymbol(name, reflect(obj).type.ow
ner)).reflectee; | 21 return reflect(obj) |
| 22 .getField(MirrorSystem.getSymbol(name, reflect(obj).type.owner)) |
| 23 .reflectee; |
22 } | 24 } |
23 | 25 |
24 class A <T> {} | 26 class A<T> {} |
25 class B <S extends num> {} | 27 |
| 28 class B<S extends num> {} |
26 | 29 |
27 class S {} | 30 class S {} |
| 31 |
28 class M {} | 32 class M {} |
| 33 |
29 class MA extends S with M {} | 34 class MA extends S with M {} |
30 | 35 |
31 class Node { | 36 class Node { |
32 static var classField; | 37 static var classField; |
33 | 38 |
34 var nullable; | 39 var nullable; |
35 var mixedType; | 40 var mixedType; |
36 var array; | 41 var array; |
37 var bigint; | 42 var bigint; |
38 var blockClean; | 43 var blockClean; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 return block; | 106 return block; |
102 } | 107 } |
103 | 108 |
104 genFullBlockWithChain() { | 109 genFullBlockWithChain() { |
105 var x = 0; | 110 var x = 0; |
106 outer() { | 111 outer() { |
107 var y = 0; | 112 var y = 0; |
108 block() => x++ + y++; | 113 block() => x++ + y++; |
109 return block; | 114 return block; |
110 } | 115 } |
| 116 |
111 return outer; | 117 return outer; |
112 } | 118 } |
113 | 119 |
114 f(int x) { | 120 f(int x) { |
115 ++x; | 121 ++x; |
116 return x; | 122 return x; |
117 } | 123 } |
118 | 124 |
119 static staticMain() { | 125 static staticMain() { |
120 node.main(); | 126 node.main(); |
(...skipping 13 matching lines...) Expand all Loading... |
134 | 140 |
135 array = new List(3); | 141 array = new List(3); |
136 array[0] = 1; | 142 array[0] = 1; |
137 array[1] = 2; | 143 array[1] = 2; |
138 array[2] = 3; | 144 array[2] = 3; |
139 bigint = 1 << 65; | 145 bigint = 1 << 65; |
140 blockClean = genCleanBlock(); | 146 blockClean = genCleanBlock(); |
141 blockCopying = genCopyingBlock(); | 147 blockCopying = genCopyingBlock(); |
142 blockFull = genFullBlock(); | 148 blockFull = genFullBlock(); |
143 blockFullWithChain = genFullBlockWithChain(); | 149 blockFullWithChain = genFullBlockWithChain(); |
144 boundedType = extractPrivateField(reflect(new B<int>()).type.typeVariables.s
ingle, '_reflectee'); | 150 boundedType = extractPrivateField( |
| 151 reflect(new B<int>()).type.typeVariables.single, '_reflectee'); |
145 counter = new Counter("CounterName", "Counter description"); | 152 counter = new Counter("CounterName", "Counter description"); |
146 expando = new Expando("expando-name"); | 153 expando = new Expando("expando-name"); |
147 expando[array] = 'The weakly associated value'; | 154 expando[array] = 'The weakly associated value'; |
148 float32x4 = new Float32x4(0.0, -1.0, 3.14, 2e28); | 155 float32x4 = new Float32x4(0.0, -1.0, 3.14, 2e28); |
149 float64 = 3.14; | 156 float64 = 3.14; |
150 float64x2 = new Float64x2(0.0, 3.14); | 157 float64x2 = new Float64x2(0.0, 3.14); |
151 gauge = new Gauge("GaugeName", "Gauge description", 0.0, 100.0); | 158 gauge = new Gauge("GaugeName", "Gauge description", 0.0, 100.0); |
152 growableList = new List(); | 159 growableList = new List(); |
153 int32x4 = new Int32x4(0,1,10,11); | 160 int32x4 = new Int32x4(0, 1, 10, 11); |
154 map = { "x-key": "x-value", "y-key": "y-value", "removed-key": "removed-valu
e" }; | 161 map = { |
| 162 "x-key": "x-value", |
| 163 "y-key": "y-value", |
| 164 "removed-key": "removed-value" |
| 165 }; |
155 map.remove("removed-key"); | 166 map.remove("removed-key"); |
156 mint = 1 << 32; | 167 mint = 1 << 32; |
157 mirrorClass = reflectClass(Object); | 168 mirrorClass = reflectClass(Object); |
158 mirrorClosure = reflect(blockFull); | 169 mirrorClosure = reflect(blockFull); |
159 mirrorInstance = reflect("a reflectee"); | 170 mirrorInstance = reflect("a reflectee"); |
160 mirrorReference = extractPrivateField(mirrorClass, '_reflectee'); | 171 mirrorReference = extractPrivateField(mirrorClass, '_reflectee'); |
161 portReceive = new RawReceivePort(); | 172 portReceive = new RawReceivePort(); |
162 portSend = portReceive.sendPort; | 173 portSend = portReceive.sendPort; |
163 regex = new RegExp("a*b+c"); | 174 regex = new RegExp("a*b+c"); |
164 smi = 7; | 175 smi = 7; |
165 stacktrace = genStackTrace(); | 176 stacktrace = genStackTrace(); |
166 string = "Hello $smi ${smi.runtimeType}"; | 177 string = "Hello $smi ${smi.runtimeType}"; |
167 stringLatin1 = "blåbærgrød"; | 178 stringLatin1 = "blåbærgrød"; |
168 stringSnowflake = "❄"; | 179 stringSnowflake = "❄"; |
169 stringUnicode = "Îñţérñåţîöñåļîžåţîờñ"; | 180 stringUnicode = "Îñţérñåţîöñåļîžåţîờñ"; |
170 stringHebrew = "שלום רב שובך צפורה נחמדת"; // An example of Right-to-Left. | 181 stringHebrew = "שלום רב שובך צפורה נחמדת"; // An example of Right-to-Left. |
171 stringTrebleClef = "𝄞"; // An example of a surrogate pair. | 182 stringTrebleClef = "𝄞"; // An example of a surrogate pair. |
172 theFalse = false; | 183 theFalse = false; |
173 theNull = null; | 184 theNull = null; |
174 theTrue = true; | 185 theTrue = true; |
175 type = String; | 186 type = String; |
176 typeParameter = extractPrivateField(reflectClass(A).typeVariables.single, '_
reflectee'); | 187 typeParameter = |
| 188 extractPrivateField(reflectClass(A).typeVariables.single, '_reflectee'); |
177 typedData = extractPrivateField(new ByteData(64), '_typedData'); | 189 typedData = extractPrivateField(new ByteData(64), '_typedData'); |
178 userTag = new UserTag("Example tag name"); | 190 userTag = new UserTag("Example tag name"); |
179 weakProperty = extractPrivateField(expando, '_data').firstWhere((e) => e !=
null); | 191 weakProperty = |
| 192 extractPrivateField(expando, '_data').firstWhere((e) => e != null); |
180 | 193 |
181 Isolate.spawn(secondMain, "Hello2").then((otherIsolate) { | 194 Isolate.spawn(secondMain, "Hello2").then((otherIsolate) { |
182 isolate = otherIsolate; | 195 isolate = otherIsolate; |
183 portSend = otherIsolate.controlPort; | 196 portSend = otherIsolate.controlPort; |
184 capability = otherIsolate.terminateCapability; | 197 capability = otherIsolate.terminateCapability; |
185 }); | 198 }); |
186 Isolate.spawn(secondMain, "Hello3").then((otherIsolate) { | 199 Isolate.spawn(secondMain, "Hello3").then((otherIsolate) { |
187 isolate = otherIsolate; | 200 isolate = otherIsolate; |
188 portSend = otherIsolate.controlPort; | 201 portSend = otherIsolate.controlPort; |
189 capability = otherIsolate.terminateCapability; | 202 capability = otherIsolate.terminateCapability; |
190 }); | 203 }); |
191 | 204 |
192 print("Finished main"); | 205 print("Finished main"); |
193 busy(); | 206 busy(); |
194 } | 207 } |
195 | 208 |
196 busy() { | 209 busy() { |
197 var localVar = 0; | 210 var localVar = 0; |
198 while (true) { | 211 while (true) { |
199 localVar = (localVar + 1) & 0xFFFF; | 212 localVar = (localVar + 1) & 0xFFFF; |
200 } | 213 } |
201 } | 214 } |
202 } | 215 } |
203 | 216 |
204 secondMain(msg) { | 217 secondMain(msg) { |
205 print("Hello from second isolate"); | 218 print("Hello from second isolate"); |
206 } | 219 } |
207 | 220 |
208 var typed; | 221 var typed; |
| 222 |
209 class Typed { | 223 class Typed { |
210 var float32List = new Float32List(16); | 224 var float32List = new Float32List(16); |
211 var float64List = new Float64List(16); | 225 var float64List = new Float64List(16); |
212 | 226 |
213 var int32x4 = new Int32x4(1, 2, 3, 4); | 227 var int32x4 = new Int32x4(1, 2, 3, 4); |
214 var float32x4 = new Float32x4.zero(); | 228 var float32x4 = new Float32x4.zero(); |
215 var float64x2 = new Float64x2.zero(); | 229 var float64x2 = new Float64x2.zero(); |
216 var int32x4List = new Int32x4List(16); | 230 var int32x4List = new Int32x4List(16); |
217 var float32x4List = new Float32x4List(16); | 231 var float32x4List = new Float32x4List(16); |
218 var float64x2List = new Float64x2List(16); | 232 var float64x2List = new Float64x2List(16); |
(...skipping 30 matching lines...) Expand all Loading... |
249 typed = new Typed(); | 263 typed = new Typed(); |
250 node = new Node(); | 264 node = new Node(); |
251 Node.staticMain(); | 265 Node.staticMain(); |
252 } | 266 } |
253 | 267 |
254 class C { | 268 class C { |
255 static doPrint() { | 269 static doPrint() { |
256 print("Original"); | 270 print("Original"); |
257 } | 271 } |
258 } | 272 } |
OLD | NEW |