Closed pshc closed 7 years ago
This list would handle a lot of the remaining edge cases, so thank you for tackling them!
The whitespace logic is obviously throwing a wrench in these fixes, and I actually dealt with these issues before. The unsatisfactory result was parsing "where" clauses as any old statement and asserting that they are the last statement, but this prevents successive let clauses or let ... in from being parsed right. I think this PR is a step in the right direction, I'll try to review more in depth tomorrow.
The let
... where
... wrapArgv
issue looks slightly worse, the let statement seems to only encapsulate one statement:
;let{ ret = Rust.VarName "cmV0"
};emitItems [Rust.Item [] Rust.Private (
Rust.Function [] "bWFpbg==" [] (Rust.TypeName "KCk=") (statementsToBlock (
setup ++
[ bind Rust.Immutable ret $
Rust.UnsafeExpr $ Rust.Block [] $ Just $
call realName args ] ++
exprToStatements (call "OjpzdGQ6OnByb2Nlc3M6OmV4aXQ=" [Rust.Var ret])
)))]
}where{
bind mut var val = Rust.Let mut var Nothing (Just val)
;call fn args = Rust.Call (Rust.Var (Rust.VarName fn)) args
;chain method args obj = Rust.MethodCall obj (Rust.VarName method) args
}wrapArgv [] = return ([], [])
I'm unsure how it parses on master, I should check that next. (This was generated by uncommenting the two lines in test_no_regressions
that write out test.txt
.)
Forgive me if I'm wrong but I think let { ret = Rust.VarName "cmV0" };
is correct?
What I'm wondering is why we get
Error: Unrecognized token `wrapArgv`:
774 |
775 |
776 | }wrapArgv [] = return ([], [])
does there need to be a semicolon before wrapArgv
or something?
Rebased on master. Time for another long plane ride.
Yes, you're right. (I need to pick up a book...) I believe it's a bug in the LHS stripper. Looking into it now.
Fixed the wrapArgv issue! (see 36a155b) I tried to knock out the rest of your list also, feel free to restructure any of those solutions.
There's only three or so remaining issues before this PR passes tests again. Can't wait to have proper let and where output in the generated code.
Passes tests. Merge whenever you're inclined to.
Whoaaa! Awesome! 🥇
I had a lot of free time on my hands yesterday (5 hour plane ride) and while trying to knock out some smaller bugs I noticed we have structural AST issues. Not sure yet if I made it better or worse.
DoStatement
for do syntax, fixinglet
codegen (#34)where
closer to how I understand it, at least<pat> = <expr>
againpat <- expr
using conv_expr_to_patlet a = 2 in ...
expressions (#45)where
issue in corrode: search forwrapArgv
, it should be in thewhere
<-
in guards (?)|
in let?