Skip to content

Commit

Permalink
refactor: move and rename src/prettyPrinter.ts to `src/ast/ast-prin…
Browse files Browse the repository at this point in the history
…ter.ts`

Fixes #1420
  • Loading branch information
i582 committed Jan 20, 2025
1 parent f831d9d commit 0186f10
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Some other codegen tests are as follows:

### Pretty-printer and AST comparators

The entry point to the Tact AST pretty-printer is [src/prettyPrinter.ts](./src/prettyPrinter.ts). It is going to be used for the Tact source code formatter once the parser keeps comments and other relevant information.
The entry point to the Tact AST pretty-printer is [src/ast/ast-printer.ts](./src/ast/ast-printer.ts). It is going to be used for the Tact source code formatter once the parser keeps comments and other relevant information.

The AST comparator is defined in [src/ast/compare.ts](./src/ast/compare.ts). This is useful, for instance, for static analysis tools which can re-use the Tact TypeScript API.

Expand Down
6 changes: 3 additions & 3 deletions src/prettyPrinter.ts → src/ast/ast-printer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as A from "./ast/ast";
import { groupBy, intercalate, isUndefined } from "./utils/array";
import { makeVisitor } from "./utils/tricks";
import * as A from "./ast";
import { groupBy, intercalate, isUndefined } from "../utils/array";
import { makeVisitor } from "../utils/tricks";

//
// Types
Expand Down
2 changes: 1 addition & 1 deletion src/generator/writers/writeFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { resolveFuncTupleType } from "./resolveFuncTupleType";
import { ops } from "./ops";
import { freshIdentifier } from "./freshIdentifier";
import { idTextErr, throwInternalCompilerError } from "../../error/errors";
import { ppAsmShuffle } from "../../prettyPrinter";
import { ppAsmShuffle } from "../../ast/ast-printer";

export function writeCastedExpression(
expression: AstExpression,
Expand Down
2 changes: 1 addition & 1 deletion src/test/prettyPrinter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "fs";
import { prettyPrint } from "../prettyPrinter";
import { prettyPrint } from "../ast/ast-printer";
import { getParser } from "../grammar";
import { join } from "path";
import { trimTrailingCR, CONTRACTS_DIR } from "./util";
Expand Down
2 changes: 1 addition & 1 deletion src/test/rename.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from "fs";
import { join } from "path";
import { AstRenamer } from "../ast/rename";
import { prettyPrint } from "../prettyPrinter";
import { prettyPrint } from "../ast/ast-printer";
import { trimTrailingCR, CONTRACTS_DIR } from "./util";
import * as assert from "assert";
import { getParser } from "../grammar";
Expand Down
2 changes: 1 addition & 1 deletion src/types/resolveExpression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { GlobalFunctions } from "../abi/global";
import { isAssignable, moreGeneralType } from "./subtyping";
import { throwInternalCompilerError } from "../error/errors";
import { StructFunctions } from "../abi/struct";
import { prettyPrint } from "../prettyPrinter";
import { prettyPrint } from "../ast/ast-printer";

const store = createContextStore<{
ast: AstExpression;
Expand Down

0 comments on commit 0186f10

Please sign in to comment.