-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add support for duration primitive type in code generation #33
Conversation
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.
looking good. But how did we land on adding tests for this?
You mean these tests aren't necessary or enough for checking duration representation ? Should I remove this ? |
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.
sorry, missed the test files somehow. all good.
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.
ehem... better to actually read the code before approving ... the tests are not testing the duration type but u64 types...
@@ -365,6 +365,7 @@ pub fn generate_type(ty: &Type) -> dart::Tokens { | |||
| Type::Int64 | |||
| Type::UInt16 | |||
| Type::Int32 | |||
| Type::Duration |
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 am not sure this is needed at all....
@@ -22,7 +24,8 @@ fn render_literal(literal: &Literal) -> String { | |||
| Type::UInt32 | |||
| Type::UInt64 | |||
| Type::Float32 | |||
| Type::Float64 => num_str, | |||
| Type::Float64 | |||
| Type::Duration => num_str, |
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.
neither that this is actually needed.
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 looks good, and it looks like the tests passed
render_literal
function for Duration literals.impl_code_type_for_primitive!
andimpl_renderable_for_primitive!
instances forDurationCodeType
.liftDuration
andlowerDuration
functions togenerate_wrapper_lifters
andgenerate_wrapper_lowerers
respectively.generate_wrapper_lifters
andgenerate_wrapper_lowerers
to handle Duration type.