From ffb448e8e02699a0b659a286f37a981e1ca1c967 Mon Sep 17 00:00:00 2001 From: verytactical <186486509+verytactical@users.noreply.github.com> Date: Tue, 14 Jan 2025 16:36:10 +0400 Subject: [PATCH] refactor: remove unused `check.ts` (#1313) --- CHANGELOG.md | 1 + src/check.ts | 110 --------------------------------------------------- src/main.ts | 1 - 3 files changed, 1 insertion(+), 111 deletions(-) delete mode 100644 src/check.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index d2bee0dcf..d7d550f2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - To reduce fees, Tact no longer stores the parent contract code in the system cell that holds all the child contract codes used in `initOf`. Instead, the `MYCODE` instruction is used: PR [#1213](https://github.com/tact-lang/tact/pull/1213) - Generated TS wrappers now use `const` where possible for variable declarations: PR [#1292](https://github.com/tact-lang/tact/pull/1292) - Allow serialization specifiers for trait fields PR: [#1303](https://github.com/tact-lang/tact/pull/1303) +- Remove unused typechecker wrapper with the file `check.ts` it is contained in: PR [#1313](https://github.com/tact-lang/tact/pull/1313) ### Fixed diff --git a/src/check.ts b/src/check.ts deleted file mode 100644 index ce5a19253..000000000 --- a/src/check.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { featureEnable } from "./config/features"; -import { CompilerContext } from "./context"; -import { getAstFactory } from "./grammar/ast"; -import { getParser } from "./grammar"; -import files from "./imports/stdlib"; -import { createVirtualFileSystem, TactError, VirtualFileSystem } from "./main"; -import { precompile } from "./pipeline/precompile"; -import { defaultParser } from "./grammar/grammar"; - -export type CheckResultItem = { - type: "error" | "warning"; - message: string; - location?: { - file: string; - line: number; - column: number; - length: number; - }; -}; - -export type CheckResult = - | { - ok: true; - } - | { - ok: false; - messages: CheckResultItem[]; - }; - -export function check(args: { - project: VirtualFileSystem; - entrypoint: string; -}): CheckResult { - // Create context - const stdlib = createVirtualFileSystem("@stdlib/", files); - let ctx: CompilerContext = new CompilerContext(); - ctx = featureEnable(ctx, "debug"); // Enable debug flag (does not affect type checking in practice) - ctx = featureEnable(ctx, "external"); // Enable external messages flag to avoid external-specific errors - - const ast = getAstFactory(); - const parser = getParser(ast, defaultParser); - - // Execute check - const items: CheckResultItem[] = []; - try { - precompile(ctx, args.project, stdlib, args.entrypoint, parser, ast); - } catch (e) { - if (e instanceof TactError) { - items.push({ - type: "error", - message: e.message, - location: - e.loc === undefined - ? undefined - : e.loc.file - ? { - file: e.loc.file, - line: e.loc.interval.getLineAndColumn().lineNum, - column: e.loc.interval.getLineAndColumn() - .colNum, - length: - e.loc.interval.endIdx - - e.loc.interval.startIdx, - } - : { - file: args.entrypoint, - line: 0, - column: 0, - length: 0, - }, - }); - } else { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const msg = (e as any).message; - if (typeof msg === "string") { - items.push({ - type: "error", - message: msg, - location: { - file: args.entrypoint, - line: 0, - column: 0, - length: 0, - }, - }); - } else { - items.push({ - type: "error", - message: "Unknown internal message", - location: { - file: args.entrypoint, - line: 0, - column: 0, - length: 0, - }, - }); - } - } - } - - if (items.length > 0) { - return { - ok: false, - messages: items, - }; - } - return { - ok: true, - }; -} diff --git a/src/main.ts b/src/main.ts index 88816f83d..76cc91a1b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -17,4 +17,3 @@ export * from "./browser"; export * from "./verify"; export * from "./logger"; export * from "./errors"; -export * from "./check";