-
Notifications
You must be signed in to change notification settings - Fork 51
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
Initial Dart backend #355
Initial Dart backend #355
Conversation
{%- endif %} | ||
{{ m.declaration -}} { {##} | ||
{%- for slice_conversion in m.slice_conversions %} | ||
{%- if loop.first %} |
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.
suggestion: I know it would get ugly to indent the actual code this way, but can we indent the jinja bits?
ffi_cast_type_name: Cow<'a, str>, | ||
dart_type_name: Cow<'a, str>, | ||
get_expression: Cow<'a, str>, | ||
set_cleanups: Vec<String>, |
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.
thought: hm, i'm not sure if we should lazy-convert these structs as opposed to eagerly converting them into pure dart structs. especially for things like string conversions. thoughts?
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.
Hmm, it's a tradeoff because for argument structs, this is the lazy conversion
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.
wait no, other way around, for return structs this is the lazy conversion
} else { | ||
format!("static {return_ty} {method_name}({params})") | ||
} | ||
// } else if method.params.is_empty() && return_ty != "void" && method_name != "toString" { |
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.
question: what's this about? to be deleted, or to be readded later?
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.
to be readded. I need a better way to figure out if a method is actually a pure getter
tool/src/dart/class.rs
Outdated
let method_name = self.cx.formatter.fmt_method_name(method); | ||
let declaration = if method.param_self.is_none() { | ||
if return_ty == type_name { | ||
format!("factory {type_name}.{method_name}({params})") |
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.
thought: this is the kind of logic Shane likes to have in the template but I'm not so sure
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 is a single line and too complex to handle in the template
Part of #439