OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.mirrors_used; | 5 library dart2js.mirrors_used; |
6 | 6 |
7 import 'dart2jslib.dart' show | 7 import 'dart2jslib.dart' show |
8 Compiler, | 8 Compiler, |
9 CompilerTask, | 9 CompilerTask, |
10 Constant, | 10 Constant, |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
448 return interface.asInstanceOf(supertype.element); | 448 return interface.asInstanceOf(supertype.element); |
449 } | 449 } |
450 } | 450 } |
451 } | 451 } |
452 return type; | 452 return type; |
453 } | 453 } |
454 | 454 |
455 /// Ensure a list contains only strings. | 455 /// Ensure a list contains only strings. |
456 List<String> convertToListOfStrings(List list) { | 456 List<String> convertToListOfStrings(List list) { |
457 if (list == null) return null; | 457 if (list == null) return null; |
458 List<String> result = new List<String>(list.length); | 458 List<String> result = new List<String>(list.length); |
karlklose
2013/12/12 07:57:18
Why not initialize result with '<String>[]' and th
ahe
2013/12/12 09:58:07
I know the size I need. I couldn't find any way to
karlklose
2013/12/12 10:27:49
toList will create a new List and add the elements
ahe
2013/12/12 11:04:59
That sounds like a performance bug in toList.
| |
459 int count = 0; | 459 int count = 0; |
460 for (var entry in list) { | 460 for (var entry in list) { |
461 assert(invariant(spannable, entry is String)); | 461 assert(invariant(spannable, entry is String)); |
karlklose
2013/12/12 07:57:18
Why this invariant? Checked mode will already chec
ahe
2013/12/12 09:58:07
Checked mode doesn't know which AST node (or eleme
| |
462 result[count++] = entry; | 462 result[count++] = entry; |
463 } | 463 } |
464 return result; | 464 return result.toList(growable: true); |
karlklose
2013/12/12 10:27:49
'true' is the default.
ahe
2013/12/12 11:04:59
Yes. But I'm passing the value explicitly to docum
| |
465 } | 465 } |
466 | 466 |
467 /// Convert a list of strings and types to a list of elements. Types are | 467 /// Convert a list of strings and types to a list of elements. Types are |
468 /// converted to their corresponding element, and strings are resolved as | 468 /// converted to their corresponding element, and strings are resolved as |
469 /// follows: | 469 /// follows: |
470 /// | 470 /// |
471 /// First find the longest library name that is a prefix of the string, if | 471 /// First find the longest library name that is a prefix of the string, if |
472 /// there are none, resolve using [resolveExpression]. Otherwise, resolve the | 472 /// there are none, resolve using [resolveExpression]. Otherwise, resolve the |
473 /// rest of the string using [resolveLocalExpression]. | 473 /// rest of the string using [resolveLocalExpression]. |
474 List<Element> resolveUsageList(List list) { | 474 List<Element> resolveUsageList(List list) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
591 // @MirrorsUsed(targets: fisk) | 591 // @MirrorsUsed(targets: fisk) |
592 // ^^^^ | 592 // ^^^^ |
593 // | 593 // |
594 // Instead of saying 'fisk' should pretty print the problematic constant | 594 // Instead of saying 'fisk' should pretty print the problematic constant |
595 // value. | 595 // value. |
596 return spannable; | 596 return spannable; |
597 } | 597 } |
598 return node; | 598 return node; |
599 } | 599 } |
600 } | 600 } |
OLD | NEW |