Skip to content

Ask the server about superclasses and retire the lexer - #56

Merged
PiotrRogulski merged 1 commit into
claude/quirky-hawking-jdfvsx-3-selection-rangesfrom
claude/quirky-hawking-jdfvsx-4-superclasses
Sep 17, 2026
Merged

PiotrRogulski merged 1 commit into
claude/quirky-hawking-jdfvsx-3-selection-rangesfrom
claude/quirky-hawking-jdfvsx-4-superclasses

Conversation

@PiotrRogulski

@PiotrRogulski PiotrRogulski commented Sep 17, 2026

Copy link
Copy Markdown
Member

After this, ciach reads no Dart syntax itself; only comment blanking remains, for the directive rewriting after --remove.

  • SuperclassChecks: dart/textDocument/super names the class's superclass; that file's documentSymbol (works unopened, SDK included) gives its constructors' parameter lists. The class's last constructor is removable when the superclass has no constructors or an unnamed one with only optional parameters. Replaces ctorForwardsSuper, which scanned for super./super(.
  • isStatePairingReference: sole type argument of State<…> in an extends clause, from the node chain; replaces two regexes.
  • isDeclaredInTypeHeader: a header declaration's chain reaches the type's node before any body node.
  • lexing.dart loses the tokenizer and becomes comment_stripping.dart; SourceIndex loses its token API.

Behavior: a dead sole constructor of a StatelessWidget subclass is now removable, not report-only. A State<Foo> type annotation outside an extends clause counts as a use.

🤖 Generated with Claude Code

https://claude.ai/code/session_0146xh6qZsHDegsCAoRBEqwz

@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 4d90018 to ab5df44 Compare September 17, 2026 09:31
@PiotrRogulski
PiotrRogulski added this pull request to stack #57 September 17, 2026 09:35
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from ab5df44 to 9813eab Compare September 17, 2026 10:17
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 9813eab to f0c2e2d Compare September 17, 2026 10:37
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from f0c2e2d to fbc4d81 Compare September 17, 2026 10:39
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from fbc4d81 to de49abd Compare September 17, 2026 10:40
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from de49abd to d8b64db Compare September 17, 2026 11:43
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from d8b64db to 1512324 Compare September 17, 2026 11:44
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 1512324 to 2600ce9 Compare September 17, 2026 11:50
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 2600ce9 to 2efe7d9 Compare September 17, 2026 11:53
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 2efe7d9 to 01e313b Compare September 17, 2026 11:56
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 01e313b to 63c1764 Compare September 17, 2026 12:08
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 63c1764 to a8c42c1 Compare September 17, 2026 12:31
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from a8c42c1 to 543645f Compare September 17, 2026 12:38
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 543645f to 1662dc1 Compare September 17, 2026 12:40
Comment thread lib/src/superclasses.dart Outdated
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 1662dc1 to db83824 Compare September 17, 2026 12:56
Comment thread lib/src/superclasses.dart Outdated
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from db83824 to 6a44db4 Compare September 17, 2026 13:03

@PiotrRogulski PiotrRogulski left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please go over all your comments here again, there's so much prose and I don't believe it's all actually needed

@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 6a44db4 to fb08fa2 Compare September 17, 2026 13:15
Comment thread test/superclasses_test.dart
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from fb08fa2 to 8f0de6a Compare September 17, 2026 13:26
@PiotrRogulski
PiotrRogulski marked this pull request as ready for review September 17, 2026 13:30
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 8f0de6a to 93beddc Compare September 17, 2026 19:32
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 93beddc to 3467258 Compare September 17, 2026 19:48
Comment thread lib/src/comment_stripping.dart
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 3467258 to ef08595 Compare September 17, 2026 20:22
Comment thread lib/src/superclasses.dart Outdated
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from ef08595 to 7b269c2 Compare September 17, 2026 20:42
Comment thread lib/src/superclasses.dart
Whether removing a class's last constructor compiles depends on its
superclass having a zero-argument unnamed constructor. Resolve the
superclass with dart/textDocument/super and read its constructors from
that file's document symbols, instead of scanning the dead constructor for
`super.`/`super(`, which also blocked every StatelessWidget on super.key.
The State<Widget> pairing and header declarations move to selection
ranges too; lexing.dart keeps only the comment blanking the directive
rewriting needs.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0146xh6qZsHDegsCAoRBEqwz
@PiotrRogulski
PiotrRogulski force-pushed the claude/quirky-hawking-jdfvsx-4-superclasses branch from 7b269c2 to 2027b97 Compare September 17, 2026 20:50
@PiotrRogulski
PiotrRogulski merged commit 7f58d46 into main Sep 17, 2026
3 checks passed
@PiotrRogulski
PiotrRogulski deleted the claude/quirky-hawking-jdfvsx-4-superclasses branch September 17, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants