Enforce return statements to only be allowed at end of function body #59

Closed
opened 2022-12-17 15:09:57 +00:00 by deavmi · 2 comments
Owner

We should not allow the following (for example):

int apple(int arg1, int arg2)
{
    return 1;
    int h = 69;

    arg1=1+arg1;

    k=arg1+arg2;
    simple_functions.k=arg1+arg2;
}
We should not allow the following (for example): ```d int apple(int arg1, int arg2) { return 1; int h = 69; arg1=1+arg1; k=arg1+arg2; simple_functions.k=arg1+arg2; } ```
deavmi added the
question
label 2022-12-17 15:10:55 +00:00
Author
Owner

Solution

We could do this in the parser but that doesn't feel right, or well it can but the dependency generation is where we make sense of the parse tree generated by the parser (and subsequently build out a initialization tree and do some visitation checking etc).

## Solution We could do this in the parser but that doesn't feel right, or well it can but the dependency generation is where we make sense of the parse tree generated by the parser (and subsequently build out a initialization tree and do some visitation checking etc).
deavmi self-assigned this 2022-12-17 15:11:52 +00:00
deavmi added this to the Parser project 2022-12-17 15:12:04 +00:00
deavmi added reference vardec_varass_dependency 2022-12-17 15:36:20 +00:00
Author
Owner

This was completed with #112

This was completed with #112
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: tlang/tlang#59
No description provided.