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: [
Stmt({
type: "let",
param: {
param: this.astCreator.param({
ident: "::value",
pos: npos,
},
}),
value: Expr({
type: "call",
subject: Expr({

View File

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

View File

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