)]}'
{
  "commit": "4e5144ac9b7b0907aa77c8f4fbb83d8fc8025e3f",
  "tree": "80dd9102628e30c1723835c83395c1f6759fa708",
  "parents": [
    "ebfcd436da65802a2b20d415afe600b51e432305"
  ],
  "author": {
    "name": "Paul Berry",
    "email": "paulberry@google.com",
    "time": "Wed Dec 11 01:39:34 2024 +0000"
  },
  "committer": {
    "name": "Commit Queue",
    "email": "dart-scoped@luci-project-accounts.iam.gserviceaccount.com",
    "time": "Wed Dec 11 01:39:34 2024 +0000"
  },
  "message": "[front end] Rework null shorting to use shared infrastructure.\n\nRework the implementation of null shorting in the front end to make\nuse of the shared infrastructure implemented in\nhttps://dart-review.googlesource.com/c/sdk/+/399480.\n\nThe shared infrastructure keeps track of null-aware guards on a stack\n(owned by `NullShortingMixin`), so the class\n`NullAwareExpressionInferenceResult` is no longer necessary. And the\nplumbing that used to be necessary to pass around linked lists of\nnull-aware guards is no longer needed. Also, several members of\n`ExpressionInferenceResult` are no longer needed (`nullAwareGuards`,\n`nullAwareAction`, `nullAwareActionType`, and `stopShorting`).\n\nSome code remains in the front end but had to be moved:\n\n- The logic to promote the synthetic temporary variable to\n  non-nullable was moved from the `NullAwareGuard` constructor to\n  `InferenceVisitorImpl.createNullAwareGuard`. This was necessary to\n  ensure that the promotions are done in the correct order (first the\n  shared method `startNullShorting` promotes the expression to the\n  left of the `?.`, and then\n  `InferenceVisitorImpl.createNullAwareGuard` promotes the synthetic\n  temporary variable).\n\n- The logic for desugaring a null-aware cascade expression is now\n  implemented directly in `visitCascade`, rather than taking advantage\n  of the shared infrastructure for null shorting. The rationale for\n  this is twofold:\n\n  - Null-aware cascades don\u0027t fully participate in null-shorting,\n    because cascade sections are greedily parsed, so it’s impossible\n    for a cascade section to be followed by any selectors that might\n    continue the null shorting. So trying to re-use the shared null\n    shorting infrastructure for cascade expressions would be overkill.\n\n  - The way the front end lowers a null-aware cascade is not ideal\n    (`x?..f()` is lowered to `let tmp \u003d x in x \u003d\u003d null ? null :\n    BlockExpression({ tmp.f(); }, tmp)`, which has the disadvantage\n    that it\u0027s not obvious to back-end optimization passes that the\n    value of the cascade expression is equal to the value of the\n    temporary variable). Keeping the logic for null-aware cascades\n    separate from the logic for null shorting will make it easier to\n    experiment with better lowerings in the future.\n\nAlso, since the front end doesn\u0027t always use the shared method\n`analyzeExpression` for analyzing subexpressions, the shared logic for\nnull shorting in `analyzeExpression` was replicated in\n`InferenceVisitorImpl.inferExpression`. In a future CL I would like to\nchange the front end to always use the shared method\n`analyzeExpression` for analyzing subexpressions, so\n`InferenceVisitorImpl.inferExpression` won\u0027t be needed.  But that\u0027s\nnot possible right now, because `InferenceVisitorImpl.inferExpression`\nhas behaviors that aren\u0027t implemented in the shared method\n`analyzeExpression` yet (see the optional parameters `isVoidAllowed`\nand `forEffect`).\n\nChange-Id: I4d11e373bb87c3c51bcaf445880d1bffbb5c0b22\nReviewed-on: https://dart-review.googlesource.com/c/sdk/+/398120\nReviewed-by: Johnni Winther \u003cjohnniwinther@google.com\u003e\nCommit-Queue: Paul Berry \u003cpaulberry@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "aaf6cb7a0efd020b2865f5311e7b6e61cc52efa3",
      "old_mode": 33188,
      "old_path": "pkg/front_end/lib/src/type_inference/inference_results.dart",
      "new_id": "6efb1c1800f4059eac4c1d0238edc05082032626",
      "new_mode": 33188,
      "new_path": "pkg/front_end/lib/src/type_inference/inference_results.dart"
    },
    {
      "type": "modify",
      "old_id": "46bf38d3afbc007ffb90851b4f5df0a2bd381ae9",
      "old_mode": 33188,
      "old_path": "pkg/front_end/lib/src/type_inference/inference_visitor.dart",
      "new_id": "76c52a8cc6742ed68a8109b53be75c0ac5c61b6d",
      "new_mode": 33188,
      "new_path": "pkg/front_end/lib/src/type_inference/inference_visitor.dart"
    },
    {
      "type": "modify",
      "old_id": "e2bb12f3b3e35efed6e56b3e1e1915d320688d5b",
      "old_mode": 33188,
      "old_path": "pkg/front_end/lib/src/type_inference/inference_visitor_base.dart",
      "new_id": "be6f849eaea954e828163e7c698581371eae58f6",
      "new_mode": 33188,
      "new_path": "pkg/front_end/lib/src/type_inference/inference_visitor_base.dart"
    }
  ]
}
