From aaf54ed320dc026fc805119e5dfdcae4e8851bce Mon Sep 17 00:00:00 2001 From: d1ll0n Date: Thu, 10 Nov 2022 19:53:11 -0600 Subject: [PATCH] Partial patch for node formatter Tests use specific string constants to test the formatting behavior. This uses the .raw original AST node to print child yul ast nodes. This still breaks on the copy test because some fields in InlineAssembly print different types now that YulBlock replaced YulNode and .yul is part of children. --- src/ast/ast_node_formatter.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ast/ast_node_formatter.ts b/src/ast/ast_node_formatter.ts index f477b084..cb62462f 100644 --- a/src/ast/ast_node_formatter.ts +++ b/src/ast/ast_node_formatter.ts @@ -1,4 +1,4 @@ -import { ASTContext, ASTNode } from "./"; +import { ASTContext, ASTNode, YulASTNode, YulASTNodeWithChildren } from "./"; const INDENT = " ".repeat(4); const SKIP = new Set(["requiredContext", "raw", "ownChildren"]); @@ -82,6 +82,9 @@ export class ASTNodeFormatter { } private formatNode(node: ASTNode, level: number, depth: number): string { + if (node instanceof YulASTNode || node instanceof YulASTNodeWithChildren) { + return this.formatValue(node.raw); + } const output = []; const value = this.formatNodeValue(node);