mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Merge pull request #4993 from joshuawarner32/tuple-gen-tuple-backend-experiment
Implement mono / code generation for tuples
This commit is contained in:
commit
9340a67e87
42 changed files with 1773 additions and 290 deletions
|
@ -12,6 +12,7 @@ use roc_parse::ast::{
|
|||
AssignedField, Base, Collection, CommentOrNewline, Expr, ExtractSpaces, Pattern, WhenBranch,
|
||||
};
|
||||
use roc_parse::ast::{StrLiteral, StrSegment};
|
||||
use roc_parse::ident::Accessor;
|
||||
use roc_region::all::Loc;
|
||||
|
||||
impl<'a> Formattable for Expr<'a> {
|
||||
|
@ -35,9 +36,8 @@ impl<'a> Formattable for Expr<'a> {
|
|||
| NonBase10Int { .. }
|
||||
| SingleQuote(_)
|
||||
| RecordAccess(_, _)
|
||||
| RecordAccessorFunction(_)
|
||||
| AccessorFunction(_)
|
||||
| TupleAccess(_, _)
|
||||
| TupleAccessorFunction(_)
|
||||
| Var { .. }
|
||||
| Underscore { .. }
|
||||
| MalformedIdent(_, _)
|
||||
|
@ -453,21 +453,19 @@ impl<'a> Formattable for Expr<'a> {
|
|||
buf.push(')');
|
||||
}
|
||||
}
|
||||
RecordAccessorFunction(key) => {
|
||||
AccessorFunction(key) => {
|
||||
buf.indent(indent);
|
||||
buf.push('.');
|
||||
buf.push_str(key);
|
||||
match key {
|
||||
Accessor::RecordField(key) => buf.push_str(key),
|
||||
Accessor::TupleIndex(key) => buf.push_str(key),
|
||||
}
|
||||
}
|
||||
RecordAccess(expr, key) => {
|
||||
expr.format_with_options(buf, Parens::InApply, Newlines::Yes, indent);
|
||||
buf.push('.');
|
||||
buf.push_str(key);
|
||||
}
|
||||
TupleAccessorFunction(key) => {
|
||||
buf.indent(indent);
|
||||
buf.push('.');
|
||||
buf.push_str(key);
|
||||
}
|
||||
TupleAccess(expr, key) => {
|
||||
expr.format_with_options(buf, Parens::InApply, Newlines::Yes, indent);
|
||||
buf.push('.');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue