Skip to content

Keep Location-based plugin code working with Locatables - #1928

Merged
TwitchBronBron merged 1 commit into
flatten-locationsfrom
locatable-compat
Oct 16, 2026
Merged

TwitchBronBron merged 1 commit into
flatten-locationsfrom
locatable-compat

Conversation

@TwitchBronBron

Copy link
Copy Markdown
Member

bslint v1 failed to compile against #1845 (36 errors), because Token no longer declared location. This restores compile- and runtime compatibility for plugins written against the Location API.

  • Token declares the deprecated location: Location again, as in v1.
  • Assigning token.location or node.location now moves the item instead of throwing (new util.assignLocation()). This reverses Add deprecated location/range getters to tokens and nodes #1876's read-only choice.
  • createToken, createIdentifier and the other create* functions accept a Location as well as a Locatable (util.toLocatable()).
  • A Location outside a known source gets a position in a placeholder source per uri, so util.getLocation() round-trips it and items from the same uri still combine. They don't combine with the file's parsed AST.
  • The super() call injected into constructors used hand-built tokens without the getters; it now uses the creators.

Verified: npm test passes. bslint v1 against this branch: tsc and npm run build are clean, its 136 tests pass, and lint plus --fix on playlet-lib, playlet-app and maestro-roku-sample give identical diagnostics and fixed files to v1.

🤖 Generated with Claude Code

Token declares the deprecated location again, so plugins that read token.location or pass tokens where a { location } is expected still compile. Tokens and nodes can be given a location by assigning it, and the creators accept a Location as well as a Locatable.

A Location outside a parsed source gets a position in a placeholder source for its uri, which util.getLocation() turns back into the same location.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TwitchBronBron
TwitchBronBron merged commit 7d0fbb7 into flatten-locations Oct 16, 2026
9 checks passed
@TwitchBronBron
TwitchBronBron deleted the locatable-compat branch October 16, 2026 18:47
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.

1 participant