Skip to content

Commit

Permalink
fix(pretty-printer): support AstTypedParameter AST node (#1347)
Browse files Browse the repository at this point in the history
  • Loading branch information
i582 authored Jan 17, 2025
1 parent 04db7e2 commit 4dbbf40
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Forbid the `override` modifier for functions without the corresponding super-function: PR [#1302](https://github.com/tact-lang/tact/pull/1302)
- Format empty blocks without extra empty line: PR [#1346](https://github.com/tact-lang/tact/pull/1346)
- Remove duplicate line and column info from error messages: PR [#1362](https://github.com/tact-lang/tact/pull/1362)
- Support `AstTypedParameter` AST node in pretty printer: PR [#1347](https://github.com/tact-lang/tact/pull/1347)

### Docs

Expand Down
10 changes: 7 additions & 3 deletions src/prettyPrinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,12 @@ export const ppAstStatementDestruct: Printer<A.AstStatementDestruct> =
);
};

export const ppTypedParameter: Printer<A.AstTypedParameter> =
({ name, type }) =>
(c) => {
return c.row(`${ppAstId(name)}: ${ppAstType(type)}`);
};

export const ppAstStatementBlock: Printer<A.AstStatementBlock> =
({ statements }) =>
(c) =>
Expand Down Expand Up @@ -879,9 +885,6 @@ export const ppAstNode: Printer<A.AstNode> = makeVisitor<A.AstNode>()({
destruct_mapping: () => {
throw new Error("Not implemented");
},
typed_parameter: () => {
throw new Error("Not implemented");
},
destruct_end: () => {
throw new Error("Not implemented");
},
Expand Down Expand Up @@ -918,6 +921,7 @@ export const ppAstNode: Printer<A.AstNode> = makeVisitor<A.AstNode>()({
statement_destruct: ppAstStatementDestruct,
function_attribute: exprNode(ppAstFunctionAttribute),
asm_function_def: ppAstAsmFunctionDef,
typed_parameter: ppTypedParameter,
});

/**
Expand Down

0 comments on commit 4dbbf40

Please sign in to comment.