Skip to content

Refactor to pass lint document by pointer#118

Merged
KurtWagner merged 8 commits into0.15.xfrom
0.15.x-refactor-document
Sep 22, 2025
Merged

Refactor to pass lint document by pointer#118
KurtWagner merged 8 commits into0.15.xfrom
0.15.x-refactor-document

Conversation

@KurtWagner
Copy link
Owner

@KurtWagner KurtWagner commented Sep 22, 2025

This avoids confusion around shallow copies and mutability as it was mutating what the pointers in the shallow copies were pointing to.

This is breaking in that run accepts a pointer and context is re-introduced.

Before:

fn (
    self: LintRule,
    doc: session.LintDocument,
    gpa: std.mem.Allocator,
    options: RunOptions,
) error{OutOfMemory}!?results.LintResult

After:

fn (
    self: LintRule,
    context: *session.LintContext,
    doc: *const session.LintDocument,
    gpa: std.mem.Allocator,
    options: RunOptions,
 ) error{OutOfMemory}!?results.LintResult

@KurtWagner KurtWagner added the breaking change This will likely be a breaking change label Sep 22, 2025
@KurtWagner KurtWagner merged commit 57f6035 into 0.15.x Sep 22, 2025
3 of 4 checks passed
@KurtWagner KurtWagner deleted the 0.15.x-refactor-document branch September 22, 2025 09:21
KurtWagner added a commit that referenced this pull request Sep 22, 2025
)

This avoids confusion around shallow copies and mutability as it was
mutating what the pointers in the shallow copies were pointing to.

This is breaking in that run accepts a pointer and context is
re-introduced.

Before:

```zig
fn (
    self: LintRule,
    doc: session.LintDocument,
    gpa: std.mem.Allocator,
    options: RunOptions,
) error{OutOfMemory}!?results.LintResult
```

After:

```zig
fn (
    self: LintRule,
    context: *session.LintContext,
    doc: *const session.LintDocument,
    gpa: std.mem.Allocator,
    options: RunOptions,
 ) error{OutOfMemory}!?results.LintResult
```
KurtWagner added a commit that referenced this pull request Sep 22, 2025
)

This avoids confusion around shallow copies and mutability as it was
mutating what the pointers in the shallow copies were pointing to.

This is breaking in that run accepts a pointer and context is
re-introduced.

Before:

```zig
fn (
    self: LintRule,
    doc: session.LintDocument,
    gpa: std.mem.Allocator,
    options: RunOptions,
) error{OutOfMemory}!?results.LintResult
```

After:

```zig
fn (
    self: LintRule,
    context: *session.LintContext,
    doc: *const session.LintDocument,
    gpa: std.mem.Allocator,
    options: RunOptions,
 ) error{OutOfMemory}!?results.LintResult
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change This will likely be a breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant