Skip to content

Commit

Permalink
Partial patch for node formatter
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
d1ll0n committed Nov 11, 2022
1 parent 3401364 commit aaf54ed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ast/ast_node_formatter.ts
Original file line number Diff line number Diff line change
@@ -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"]);
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit aaf54ed

Please sign in to comment.