desugar param

This commit is contained in:
sfja 2025-01-02 06:46:51 +01:00
parent ac36353609
commit 82a2f259e1
3 changed files with 16 additions and 7 deletions

View File

@ -49,10 +49,10 @@ export class ArrayLiteralDesugarer implements AstVisitor {
stmts: [ stmts: [
Stmt({ Stmt({
type: "let", type: "let",
param: { param: this.astCreator.param({
ident: "::value", ident: "::value",
pos: npos, pos: npos,
}, }),
value: Expr({ value: Expr({
type: "call", type: "call",
subject: Expr({ subject: Expr({

View File

@ -70,12 +70,18 @@ export class SpecialLoopDesugarer implements AstVisitor {
stmts: [ stmts: [
Stmt({ Stmt({
type: "let", type: "let",
param: { ident: "::values", pos: npos }, param: this.astCreator.param({
ident: "::values",
pos: npos,
}),
value: expr.kind.value, value: expr.kind.value,
}), }),
Stmt({ Stmt({
type: "let", type: "let",
param: { ident: "::length", pos: npos }, param: this.astCreator.param({
ident: "::length",
pos: npos,
}),
value: Expr({ value: Expr({
type: "call", type: "call",
subject: Expr({ subject: Expr({
@ -96,7 +102,10 @@ export class SpecialLoopDesugarer implements AstVisitor {
}), }),
Stmt({ Stmt({
type: "let", type: "let",
param: { ident: "::index", pos: npos }, param: this.astCreator.param({
ident: "::index",
pos: npos,
}),
value: Expr({ type: "int", value: 0 }), value: Expr({ type: "int", value: 0 }),
}, expr.pos), }, expr.pos),
Stmt({ Stmt({

View File

@ -52,10 +52,10 @@ export class StructLiteralDesugarer implements AstVisitor {
stmts: [ stmts: [
Stmt({ Stmt({
type: "let", type: "let",
param: { param: this.astCreator.param({
ident: "::value", ident: "::value",
pos: npos, pos: npos,
}, }),
value: Expr({ value: Expr({
type: "call", type: "call",
subject: Expr({ subject: Expr({