TortureDoubleWalk.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. final topFinal = seedValue();
  2. const topConst = 42;
  3. var topVar = 7;
  4. int topTyped = 8;
  5. final multiA = 1, multiB = 2;
  6. int seedValue() => 9;
  7. void hostFn() {
  8. void localFn(int n) {
  9. inner(n);
  10. }
  11. localFn(3);
  12. int localWithNew() {
  13. final w = new Holder(1);
  14. return w.n;
  15. }
  16. localWithNew();
  17. }
  18. class Holder {
  19. final int n;
  20. final untypedInit = 5;
  21. static var mutable = 3;
  22. Holder(this.n);
  23. Holder.other() : n = compute();
  24. void useNew() {
  25. final h = new Holder(2);
  26. void methodLocal() {
  27. h.touch();
  28. }
  29. methodLocal();
  30. }
  31. int get computed => helperCall();
  32. }
  33. void takeConst() {
  34. pad(const EdgeInsets.all(8.0));
  35. make(const Holder(3));
  36. }
  37. Future<int> asyncFn() async => 1;
  38. Stream<int> genFn() async* {
  39. yield 1;
  40. }
  41. Iterable<int> syncGen() sync* {
  42. yield 2;
  43. }
  44. /// Doc for annotated.
  45. @deprecated
  46. void annotated() {}
  47. @Deprecated('use other')
  48. class OldClass {}
  49. @pragma('vm:entry-point')
  50. void pragged() {}
  51. class Cfg {
  52. static const retries = 3;
  53. }
  54. void reader() {
  55. use(Cfg.retries);
  56. final msg = 'retry $topConst times ${topFinal}';
  57. print(msg);
  58. }
  59. void shadower() {
  60. final topConst = 1;
  61. use(topConst);
  62. }
  63. void refTaker() {
  64. register(seedValue);
  65. obj.cb = seedValue;
  66. final table = [seedValue, hostFn];
  67. final map = {'k': seedValue, 'j': notDefinedHere};
  68. reg2(cb: seedValue);
  69. final alias = seedValue;
  70. }