-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create lambda handlers #306
Conversation
|
||
class FunctionHandlerImpl( | ||
private val function: FunctionDefinition, | ||
private val analyzedFunction: AnalyzedFunction, | ||
// List of parents' handlers ordered from immediate parent. | ||
private val ancestorFunctionHandlers: List<FunctionHandler>, | ||
private val ancestorFunctionHandlers: List<CallableHandler>, // first (or last?) can be Lambda, not Function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this matter? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdym?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, I don't really understand what's this comment for 😄
Does it mean that we have to be careful what we provide in the constructor? Or how we use these handlers? Or is it just explaning why it's CallableHandler
and not FunctionHandler
.
If it's the last one then I think we don't have to explain it, it feels natural that the interface is as general as it can be.
2edc951
to
d411576
Compare
302b980
to
b92ddbe
Compare
import kotlin.math.max | ||
|
||
abstract class CallableHandlerImpl( | ||
private val analyzedFunction: AnalyzedFunction, // TODO: we need to change it so it also covers lambda expressions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also describe the TODOs here so it's all in one place: #305
@@ -22,7 +24,8 @@ class PrologueEpilogueHandler( | |||
fun generatePrologue(): List<CFGNode> { | |||
val nodes = mutableListOf<CFGNode>() | |||
nodes.add(registerUse(rsp) subeq integer(REGISTER_SIZE)) | |||
nodes.add(pushLabel(getStackFrameLocation(handler.getFunctionDeclaration()))) | |||
// TODO: how to cover lambdas here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also seems like something to think about together, no? #305
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, given that this was a bit more difficult sprint due to the confusion, good work!
Created lambda handler and made it access correctly variables from closure.
Some TODO's in PrologueEpilogueHandler and FunctionAnalysis that I believe need to be done next week.