BBx-Kitchen / bbj-language-server

BBj Language Server
MIT License
7 stars 6 forks source link

RETURN has an optional expession parameter #44

Closed StephanWald closed 3 weeks ago

StephanWald commented 1 year ago
RETURN 7

or

RETURN  X$

https://documentation.basis.cloud/BASISHelp/WebHelp/commands/return_verb.htm

StephanWald commented 2 months ago

NOTE: The RETRUN with expression is mandatory between DEF FN...FNEND blocks. Outside DEF blocks, there is never a return value. Only spend time in this detail if it's easy to do.

Lotes commented 2 months ago

@StephanWald RETURN and DEF FN...FNEND were implemented, but there is no validation like mentioned in your NOTE. I think we can easily check whether a RETURN is under a DEF.

Checking whether each path of a DEF contains a RETURN is a bit more complicated. One need to look at all control flow verbs and how they are nested in order to see where a path ends and therefore requires a RETURN. Not impossible, but also not so easy, I would say. What do you think @dhuebner and @msujew ?

StephanWald commented 2 months ago

RETURN parameter is optional, respectively only relevant when inside a DEF FN ...FNEND block

gosub lbl1
release

lbl1: 
    REM do somethin
    PRINT ""
return

lbl2:
    REM do something else
    print ""
return
StephanWald commented 2 months ago

increasing the relevance since the recent "fix" of adding the parameter now breaks most samples from the docs, where RETURN is always used w/o parameter

dhuebner commented 1 month ago

@StephanWald Issue with your last provided example is fixed in typefox-dev. It would be nice if you could check some of your example projects with the current state before release.

dhuebner commented 1 month ago

@StephanWald Merge PR to master is open. See #150

dhuebner commented 3 weeks ago

Fixed