Skip to content

Commit

Permalink
feat: initial implementation for source map from Fift assembly file f…
Browse files Browse the repository at this point in the history
…rom FunC
  • Loading branch information
i582 committed Feb 16, 2025
1 parent 531996a commit 6d973a1
Show file tree
Hide file tree
Showing 14 changed files with 4,317 additions and 52 deletions.
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default tseslint.config(
"unicorn/no-null": "off",
"unicorn/no-lonely-if": "off",
"unicorn/no-process-exit": "off",
"unicorn/prefer-module": "off",
},
},
)
15 changes: 15 additions & 0 deletions src/decompiler/source-map.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {readFileSync} from "node:fs"
import {compileFift} from "../fift/compileFift"

export type ProcedureHash = string

export type SourceMap = Map<ProcedureHash, string>

export async function obtainSourceMap(path: string): Promise<SourceMap> {
const content = readFileSync(path).toString()
const result = await compileFift(content, true)
if (result.status !== "source_map") {
return new Map()
}
return result.sourceMap
}
Loading

0 comments on commit 6d973a1

Please sign in to comment.