rokucommunity / rokucommunity/brighterscript

support continue statement

Open
#18 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

super useful statement, get's rid of need for huge if statements
can easily be implemented under the hood by injecting gotos

example code

for i = 0 to 10 
  item = items[i]
  if item.isLocked
    continue
  end if

  doSomeStuffwithItem(item)
end for

will produce code:

for i = 0 to 10 
  item = items[i]
  if item.isLocked
    goto namespace_class_method_continue1
  end if

    doSomeStuffwithItem(item)

  namespace_class_method_continue1:
end for

note, I suggest we namespace the continue label with namespace_class_method_continue_index, as we could have multiple continues in one method, or even one loop.

it might be we just namespace on per file indexes though (i.e. take filename, and each continue that appears in the file has an index that increments each time a continue is encountered)

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

Start by tracing how the parser and compiler currently handle for loops, conditional statements, gotos, and labels. Compare the requested continue example with existing control-flow behavior, then determine the label-scoping and numbering rules needed for multiple continues. Done means valid continue syntax compiles correctly and its loop-control behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.