@@ -68,8 +68,8 @@ class BackendImpacts {
68
68
helpers.getRuntimeTypeInfo,
69
69
helpers.computeSignature,
70
70
helpers.getRuntimeTypeArguments],
71
- instantiatedClasses : [
72
- coreClasses.listClass ]);
71
+ otherImpacts : [
72
+ listValues ]);
73
73
}
74
74
return _computeSignature;
75
75
}
@@ -187,16 +187,84 @@ class BackendImpacts {
187
187
return _throwNoSuchMethod;
188
188
}
189
189
190
+ BackendImpact _stringValues;
191
+
192
+ BackendImpact get stringValues {
193
+ if (_stringValues == null ) {
194
+ _stringValues = new BackendImpact (
195
+ instantiatedClasses: [
196
+ helpers.jsStringClass]);
197
+ }
198
+ return _stringValues;
199
+ }
200
+
201
+ BackendImpact _numValues;
202
+
203
+ BackendImpact get numValues {
204
+ if (_numValues == null ) {
205
+ _numValues = new BackendImpact (
206
+ instantiatedClasses: [
207
+ helpers.jsIntClass,
208
+ helpers.jsPositiveIntClass,
209
+ helpers.jsUInt32Class,
210
+ helpers.jsUInt31Class,
211
+ helpers.jsNumberClass,
212
+ helpers.jsDoubleClass]);
213
+ }
214
+ return _numValues;
215
+ }
216
+
217
+ BackendImpact get intValues => numValues;
218
+
219
+ BackendImpact get doubleValues => numValues;
220
+
221
+ BackendImpact _boolValues;
222
+
223
+ BackendImpact get boolValues {
224
+ if (_boolValues == null ) {
225
+ _boolValues = new BackendImpact (
226
+ instantiatedClasses: [
227
+ helpers.jsBoolClass]);
228
+ }
229
+ return _boolValues;
230
+ }
231
+
232
+ BackendImpact _nullValue;
233
+
234
+ BackendImpact get nullValue {
235
+ if (_nullValue == null ) {
236
+ _nullValue = new BackendImpact (
237
+ instantiatedClasses: [
238
+ helpers.jsNullClass]);
239
+ }
240
+ return _nullValue;
241
+ }
242
+
243
+ BackendImpact _listValues;
244
+
245
+ BackendImpact get listValues {
246
+ if (_listValues == null ) {
247
+ _listValues = new BackendImpact (
248
+ instantiatedClasses: [
249
+ helpers.jsArrayClass,
250
+ helpers.jsMutableArrayClass,
251
+ helpers.jsFixedArrayClass,
252
+ helpers.jsExtendableArrayClass,
253
+ helpers.jsUnmodifiableArrayClass]);
254
+ }
255
+ return _listValues;
256
+ }
257
+
190
258
BackendImpact _throwRuntimeError;
191
259
192
260
BackendImpact get throwRuntimeError {
193
261
if (_throwRuntimeError == null ) {
194
262
_throwRuntimeError = new BackendImpact (
195
263
staticUses: [
196
264
helpers.throwRuntimeError],
197
- // Also register the types of the arguments passed to this method.
198
- instantiatedClasses : [
199
- coreClasses.stringClass ]);
265
+ otherImpacts : [
266
+ // Also register the types of the arguments passed to this method.
267
+ stringValues ]);
200
268
}
201
269
return _throwRuntimeError;
202
270
}
@@ -208,8 +276,7 @@ class BackendImpacts {
208
276
_superNoSuchMethod = new BackendImpact (
209
277
staticUses: [
210
278
helpers.createInvocationMirror,
211
- coreClasses.objectClass.lookupLocalMember (
212
- Identifiers .noSuchMethod_)],
279
+ helpers.objectNoSuchMethod],
213
280
otherImpacts: [
214
281
_needsInt (
215
282
'Needed to encode the invocation kind of super.noSuchMethod.' ),
@@ -277,23 +344,19 @@ class BackendImpacts {
277
344
/// Helper for registering that `int` is needed.
278
345
BackendImpact _needsInt (String reason) {
279
346
// TODO(johnniwinther): Register [reason] for use in dump-info.
280
- return new BackendImpact (
281
- instantiatedClasses: [coreClasses.intClass]);
347
+ return intValues;
282
348
}
283
349
284
350
/// Helper for registering that `List` is needed.
285
351
BackendImpact _needsList (String reason) {
286
352
// TODO(johnniwinther): Register [reason] for use in dump-info.
287
- return new BackendImpact (
288
- instantiatedClasses: [coreClasses.listClass]);
353
+ return listValues;
289
354
}
290
355
291
356
/// Helper for registering that `String` is needed.
292
357
BackendImpact _needsString (String reason) {
293
358
// TODO(johnniwinther): Register [reason] for use in dump-info.
294
- return new BackendImpact (
295
- instantiatedClasses: [
296
- coreClasses.stringClass]);
359
+ return stringValues;
297
360
}
298
361
299
362
BackendImpact _assertWithoutMessage;
@@ -352,62 +415,15 @@ class BackendImpacts {
352
415
return _stringJuxtaposition;
353
416
}
354
417
355
- // TODO(johnniwinther): Point to to the JavaScript classes instead of the Dart
356
- // classes in these impacts.
357
- BackendImpact _nullLiteral;
418
+ BackendImpact get nullLiteral => nullValue;
358
419
359
- BackendImpact get nullLiteral {
360
- if (_nullLiteral == null ) {
361
- _nullLiteral = new BackendImpact (
362
- instantiatedClasses: [
363
- coreClasses.nullClass]);
364
- }
365
- return _nullLiteral;
366
- }
420
+ BackendImpact get boolLiteral => boolValues;
367
421
368
- BackendImpact _boolLiteral ;
422
+ BackendImpact get intLiteral => intValues ;
369
423
370
- BackendImpact get boolLiteral {
371
- if (_boolLiteral == null ) {
372
- _boolLiteral = new BackendImpact (
373
- instantiatedClasses: [
374
- coreClasses.boolClass]);
375
- }
376
- return _boolLiteral;
377
- }
424
+ BackendImpact get doubleLiteral => doubleValues;
378
425
379
- BackendImpact _intLiteral;
380
-
381
- BackendImpact get intLiteral {
382
- if (_intLiteral == null ) {
383
- _intLiteral = new BackendImpact (
384
- instantiatedClasses: [
385
- coreClasses.intClass]);
386
- }
387
- return _intLiteral;
388
- }
389
-
390
- BackendImpact _doubleLiteral;
391
-
392
- BackendImpact get doubleLiteral {
393
- if (_doubleLiteral == null ) {
394
- _doubleLiteral = new BackendImpact (
395
- instantiatedClasses: [
396
- coreClasses.doubleClass]);
397
- }
398
- return _doubleLiteral;
399
- }
400
-
401
- BackendImpact _stringLiteral;
402
-
403
- BackendImpact get stringLiteral {
404
- if (_stringLiteral == null ) {
405
- _stringLiteral = new BackendImpact (
406
- instantiatedClasses: [
407
- coreClasses.stringClass]);
408
- }
409
- return _stringLiteral;
410
- }
426
+ BackendImpact get stringLiteral => stringValues;
411
427
412
428
BackendImpact _catchStatement;
413
429
@@ -468,7 +484,7 @@ class BackendImpacts {
468
484
if (_stackTraceInCatch == null ) {
469
485
_stackTraceInCatch = new BackendImpact (
470
486
instantiatedClasses: [
471
- coreClasses .stackTraceClass],
487
+ helpers .stackTraceClass],
472
488
staticUses: [
473
489
helpers.traceFromException]);
474
490
}
@@ -498,9 +514,8 @@ class BackendImpacts {
498
514
helpers.getRuntimeTypeInfo,
499
515
helpers.runtimeTypeToString,
500
516
helpers.createRuntimeType],
501
- instantiatedClasses: [
502
- coreClasses.listClass],
503
517
otherImpacts: [
518
+ listValues,
504
519
getRuntimeTypeArgument,
505
520
_needsInt ('Needed for accessing a type variable literal on this.' )
506
521
]);
@@ -513,8 +528,8 @@ class BackendImpacts {
513
528
BackendImpact get typeCheck {
514
529
if (_typeCheck == null ) {
515
530
_typeCheck = new BackendImpact (
516
- instantiatedClasses : [
517
- coreClasses.boolClass ]);
531
+ otherImpacts : [
532
+ boolValues ]);
518
533
}
519
534
return _typeCheck;
520
535
}
@@ -551,9 +566,8 @@ class BackendImpacts {
551
566
// TODO(johnniwinther): Investigate why this is needed.
552
567
helpers.setRuntimeTypeInfo,
553
568
helpers.getRuntimeTypeInfo],
554
- instantiatedClasses: [
555
- coreClasses.listClass],
556
569
otherImpacts: [
570
+ listValues,
557
571
getRuntimeTypeArgument]);
558
572
}
559
573
return _genericTypeCheck;
@@ -564,8 +578,8 @@ class BackendImpacts {
564
578
BackendImpact get genericIsCheck {
565
579
if (_genericIsCheck == null ) {
566
580
_genericIsCheck = new BackendImpact (
567
- instantiatedClasses : [
568
- coreClasses.listClass ]);
581
+ otherImpacts : [
582
+ intValues ]);
569
583
}
570
584
return _genericIsCheck;
571
585
}
0 commit comments