Skip to content

How to check if the correct type is returned #28

Discussion options

You must be logged in to vote

ReturnInstruction node checks if the returned type matches the return type of the function that it's in

  • Needs to somehow know the parent Function node that the return instruction is inside.

Why this makes sense

It is the return instruction's "fault" that the wrong type is returned. Usually u change the returned type to the correct one, not the function's defined return type

How it would work

  1. check() function would receive an array of parent nodes. In the sample this would be:
[
  file,
  function,
  block,
]
  1. Get the parent node which is a function. In case of a custom plugin which allows nested functions (which is awesome, so this plugin needs to be able to be made), the return instr…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ChocolateLoverRaj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant