From 4dbbf403beec34b3b068f71c26d776b722c62689 Mon Sep 17 00:00:00 2001 From: Petr Makhnev <51853996+i582@users.noreply.github.com> Date: Fri, 17 Jan 2025 06:29:04 +0400 Subject: [PATCH] fix(pretty-printer): support `AstTypedParameter` AST node (#1347) --- CHANGELOG.md | 1 + src/prettyPrinter.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb58f803a..939f3fc2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/prettyPrinter.ts b/src/prettyPrinter.ts index acdef52c9..a8a724a42 100644 --- a/src/prettyPrinter.ts +++ b/src/prettyPrinter.ts @@ -821,6 +821,12 @@ export const ppAstStatementDestruct: Printer = ); }; +export const ppTypedParameter: Printer = + ({ name, type }) => + (c) => { + return c.row(`${ppAstId(name)}: ${ppAstType(type)}`); + }; + export const ppAstStatementBlock: Printer = ({ statements }) => (c) => @@ -879,9 +885,6 @@ export const ppAstNode: Printer = makeVisitor()({ destruct_mapping: () => { throw new Error("Not implemented"); }, - typed_parameter: () => { - throw new Error("Not implemented"); - }, destruct_end: () => { throw new Error("Not implemented"); }, @@ -918,6 +921,7 @@ export const ppAstNode: Printer = makeVisitor()({ statement_destruct: ppAstStatementDestruct, function_attribute: exprNode(ppAstFunctionAttribute), asm_function_def: ppAstAsmFunctionDef, + typed_parameter: ppTypedParameter, }); /**