Skip to content

Commit

Permalink
[kernel] Clarify what TreeNode.fileOffset indexes, some rephrasing
Browse files Browse the repository at this point in the history
- Rephrase AssertStatement offset documentations to be consistent with
  the TreeNode.fileOffset documentation.

- Use a noun phrase in `TreeNode.fileOffsetsIfMultiple`, as per
  Effective Dart recommendation.

Change-Id: If3f8acb47a96effbda2526819badb943b6e6062f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366360
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
  • Loading branch information
osa1 authored and Commit Queue committed May 14, 2024
1 parent f774ec5 commit 9f94984
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pkg/kernel/lib/ast.dart
Expand Up @@ -161,13 +161,16 @@ abstract class TreeNode extends Node {

TreeNode? parent;

/// Offset in the source file it comes from.
/// Offset in the source file the node comes from.
///
/// Valid values are from 0 and up, or -1 ([noOffset]) if the file offset is
/// not available (this is the default if none is specifically set).
///
/// This is an index into [Source.text].
int fileOffset = noOffset;

/// Returns List<int> if this node has more offsets than [fileOffset].
/// When the node has more offsets that just [fileOffset], the list of all
/// offsets.
List<int>? get fileOffsetsIfMultiple => null;

@override
Expand Down Expand Up @@ -9360,12 +9363,14 @@ class AssertStatement extends Statement {
Expression condition;
Expression? message; // May be null.

/// Character offset in the source ([Source.text]) where the assertion
/// condition begins.
/// Character offset in the source where the assertion condition begins.
///
/// This is an index into [Source.text].
int conditionStartOffset;

/// Character offset in the source ([Source.text]) where the assertion
/// condition ends.
/// Character offset in the source where the assertion condition ends.
///
/// This is an index into [Source.text].
int conditionEndOffset;

@override
Expand Down

0 comments on commit 9f94984

Please sign in to comment.