-
Notifications
You must be signed in to change notification settings - Fork 2
First version of string literals handling #176
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
base: main
Are you sure you want to change the base?
Conversation
, SFunction <$> (pKeyword "function" *> identifier) <*> (parens (commaSep coreArg)) <*> (symbol "->" *> coreType) | ||
<*> (symbol "{" *> many coreStmt <* symbol "}") | ||
, SAssembly <$> (pKeyword "assembly" *> yulBlock) | ||
, SRevert <$> (pKeyword "revert" *> stringLiteral) |
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.
why?
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.
Don't know if we need revert builtin in core, but I renamed it to __revert__
, because otherwise you cannot define a function called revert
Just e -> pure (e, []) | ||
Nothing -> pure (Core.EVar (unwrapId x), []) | ||
-- special handling of revert | ||
emitExp (Call _ (Id "revert" _) [Lit(StrLit s)]) = pure(Core.EUnit, [Core.SRevert s]) |
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.
Is this supposed to be commented?
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.
Yes, I have disabled special handling of revert.
Another option might be to keep special handling of revert and transform string literals on the Core <-> Yul stage.
But the current typechecker chokes on type literals, so I decided to do it in the preliminar desugaring stage, at least for now.
For comnparison, I will try another approach, keeping string literals throughout the frontend and desugaring them in the backend. |
Quick and dirty string literal handling - literals longer than 32 chars are truncated