Skip to content

Commit

Permalink
fix: duplicate locationStr
Browse files Browse the repository at this point in the history
  • Loading branch information
verytactical committed Dec 18, 2024
1 parent 1968512 commit ed88fa3
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/error/display-to-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,8 @@
* Render error message to string for compiler CLI
*/

import { relative } from "path";
import { cwd } from "process";
import { SrcInfo } from "../grammar";
import { ErrorDisplay } from "./display";

const locationStr = (sourceInfo: SrcInfo): string => {
if (!sourceInfo.file) {
return "";
}

const loc = sourceInfo.interval.getLineAndColumn() as {
lineNum: number;
colNum: number;
};

const file = relative(cwd(), sourceInfo.file);
return `${file}:${loc.lineNum}:${loc.colNum}: `;
};
import { locationStr } from "../errors";

export const displayToString: ErrorDisplay<string> = {
text: (text) => text,
Expand Down

0 comments on commit ed88fa3

Please sign in to comment.