Refactored mutability

This commit is contained in:
2026-05-28 11:45:26 +02:00
parent 3444f93546
commit 7007aa32f1
9 changed files with 3 additions and 20 deletions
-1
View File
@@ -234,7 +234,6 @@ impl GetRust for TypeExprKind {
impl GenRust for Pattern {
fn gen_rust(&self, ctx: &mut Context, cg: &mut RustCodegen) {
match self {
Self::Id(id) => cg.add(&id.get_rust()),
Self::Path(mutable, path) => {
if *mutable {
cg.add("mut ");
-1
View File
@@ -158,7 +158,6 @@ impl GenRust for Statement {
}
Statement::For {
mutable,
pattern,
iterator,
body,
+1 -2
View File
@@ -212,8 +212,7 @@ impl GenRust for (&Vec<Spanned<FieldDeclStmt>>, &Spanned<ClassConstructor>) {
cg.add_indentedln("}\n");
let mut constructor_params = vec![VarDecl {
mutable: false,
name: Pattern::Id(Identifier(String::from("self"))),
name: Pattern::Path(false, Path(vec![Identifier(String::from("self"))])),
type_: Some(TypeExpr(
TypeExprKind::Path(Path(vec![Identifier(String::from("Self"))])),
vec![TypePostfix::RefMut],