Implement expression-less return statements #70

Open
opened 2022-12-21 09:06:39 +00:00 by deavmi · 8 comments
Owner

What is it?

Implement the ability to just do return with no expression (in the context of a void) method.

What would we need?

  • Lookahead in the parser
  • hasExpression() method in ReturnStmt
  • Dependency check for the expression using hasExpression() such that we know whether or not to pop from the codeQueue
  • ReturnInstr must have a hasExpressionInstr() such that we can yank it out and call transform(Instruction) on it as part of the transform(ReturnInstr) of "return "~transform(ReturnExprInstr)~";"
  • DGen to respect new ReturnInstruction API
## What is it? Implement the ability to just do `return` with no expression (in the context of a `void`) method. ## What would we need? - [x] Lookahead in the parser - [x] `hasExpression()` method in `ReturnStmt` - [x] Dependency check for the expression using `hasExpression()` such that we know whether or not to pop from the `codeQueue` - [x] `ReturnInstr` must have a `hasExpressionInstr()` such that we can yank it out and call `transform(Instruction)` on it as part of the `transform(ReturnInstr)` of `"return "~transform(ReturnExprInstr)~";"` - [x] `DGen` to respect new `ReturnInstruction` API
deavmi added the
typing
dependency
parser
emit
labels 2022-12-21 09:11:40 +00:00
deavmi self-assigned this 2022-12-21 09:11:43 +00:00
deavmi added this to the Basics milestone 2022-12-21 09:11:46 +00:00
deavmi added this to the Dependency tree, type-checking and codegen project 2022-12-21 09:11:51 +00:00
deavmi added the due date 2023-07-21 2023-07-13 12:59:58 +01:00
Author
Owner

I should take a look at this as well.

I should take a look at this as well.
deavmi started working 2023-07-14 18:28:48 +01:00
Author
Owner

This was finished a while back

This was finished a while back
deavmi added reference vardec_varass_dependency 2023-07-14 18:29:08 +01:00
deavmi stopped working 2023-07-14 18:29:15 +01:00
27 seconds
deavmi reopened this issue 2023-07-14 19:05:35 +01:00
deavmi started working 2024-05-07 08:56:47 +01:00
Author
Owner

Actually this is not done because emit fails:

image

Actually this is **not** done because emit fails: ![image](/attachments/407eb073-5aa1-4f42-a5da-3fa0314e5b1b)
deavmi changed reference from vardec_varass_dependency to bugfix/dgen_expressionless_returns 2024-05-07 09:01:54 +01:00
Author
Owner

DGen

  • Handle ReturnInstruction with no expression

Test cases

  • Added simple_return_expressionless.t
DGen - Handle `ReturnInstruction` with no expression Test cases - Added `simple_return_expressionless.t`
Author
Owner

Just need to add test

Just need to add test
Author
Owner

Pipelines

  • Added simple_return_expressionless.t as an emit test
Pipelines - Added `simple_return_expressionless.t` as an emit test
Author
Owner

Waiting for tests to complete...

Waiting for tests to complete...
Author
Owner

All checks pass, ready for merging

All checks pass, ready for merging ✅
deavmi added the
needsfix
label 2024-05-07 09:08:12 +01:00
deavmi stopped working 2024-05-07 09:08:18 +01:00
11 minutes 31 seconds
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Total Time Spent: 11 minutes 58 seconds
deavmi
11 minutes 58 seconds
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

2023-07-21

Dependencies

No dependencies set.

Reference: tlang/tlang#70
No description provided.