Skip to content

Commit

Permalink
[CFE] Add comments to clarify source encoding and offsets
Browse files Browse the repository at this point in the history
I mistakenly thought the offset would be the location in the List<int> source.
Hopefully these comments will prevent confusion in the future.

See:
* https://dart-review.googlesource.com/c/sdk/+/124602
* #39271
Change-Id: Iba47b477d085c2a133ccd9aca645fe10906368bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124591
Reviewed-by: Jens Johansen <[email protected]>
Commit-Queue: Nicholas Shahan <[email protected]>
  • Loading branch information
nshahan authored and [email protected] committed Nov 11, 2019
1 parent 1d65847 commit c98df62
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/kernel/lib/ast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4518,7 +4518,15 @@ class EmptyStatement extends Statement {
class AssertStatement extends Statement {
Expression condition;
Expression message; // May be null.

/// Character offset in the source where the assertion condition begins.
///
/// Note: This is not the offset into the UTF8 encoded `List<int>` source.
int conditionStartOffset;

/// Character offset in the source where the assertion condition ends.
///
/// Note: This is not the offset into the UTF8 encoded `List<int>` source.
int conditionEndOffset;

AssertStatement(this.condition,
Expand Down Expand Up @@ -7051,6 +7059,7 @@ class _ChildReplacer extends Transformer {
class Source {
final List<int> lineStarts;

/// A UTF8 encoding of the original source file.
final List<int> source;

final Uri importUri;
Expand Down

0 comments on commit c98df62

Please sign in to comment.