rokucommunity / rokucommunity/brighterscript

One-liner annotation causes validation error inside block

Open
#615 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
208
Forks
68
Avg merge
8h 39m
Merged PRs (30d)
39

Description

Im trying to create annotation plugin to inject child components into parent as members (similar to some android frameworks)

The clearest syntax I discovered so far is:

@inject m.someChild = {} // to be changed to: m.someChild = m.top.findNode("someChild")

or

@inject("name") m.someChild = {} // to be changed to: m.someChild = m.top.findNode("name")

Unfortunately such construct causes parsing error (BS1039: Expected newline or ':' at the end of a statement), even though annotation feature description says it should be possible to do it inline.

Split into two lines works,

@inject 
m.someChild = {}

@inject 
m.otherChild = {}

@inject 
m.yetAnotherChild = {}

----------- vs ------------

@inject m.someChild = {}
@inject m.otherChild = {}
@inject m.yetAnotherChild = {}

but then code base explodes and doesn't look neat.
Btw: if you are aware of cleaner syntax, let me know. Ideally it could look like @inject m.someChild but it's not an expression then

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the BS1039 error with the inline @inject examples from the issue, then inspect the annotation parsing and validation entry points. Done means the one-line forms parse without BS1039 while the existing split-line forms continue to work, with a regression test if this syntax has test coverage.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.