ton-assembly
Version:
TON assembler and disassembler
85 lines • 2.39 kB
TypeScript
import type { Mapping } from "../runtime";
import type { Loc as InstrLoc } from "../runtime/util";
/**
* Represents a location of the single instruction in the code.
*
* One instruction can be actually pointing to multiple locations in the code
* if it is contained in a Cell referenced from multiple places.
*/
export type Loc = {
readonly file: string;
readonly line: number;
readonly otherLines: number[];
};
export declare const Loc: (file: string, line: number, otherLines: number[]) => Loc;
export declare const fromParserLoc: (loc: InstrLoc) => Loc;
/**
* Describes a single instruction in the code.
*/
export type InstructionInfo = {
/**
* Name of the instruction.
*/
readonly name: string;
/**
* Location of the instruction in the file.
*/
readonly loc: undefined | Loc;
/**
* Offset of the instruction in the Cell.
*/
readonly offset: number;
/**
* Debug section number.
*
* Debug sections are used to group instructions together in the code.
* This way we later can match several instructions to a single statement in the source code.
*
* If instruction is not part of any debug section, this value is -1.
*/
readonly debugSection: number;
};
export type CellHash = string;
/**
* Describes mapping of a Cell to its instructions.
*/
export type CellsMapping = Record<CellHash, undefined | {
readonly instructions: readonly InstructionInfo[];
}>;
/**
* Describes mapping of a Dictionary cell to its data Cell.
*
* @see DictionaryInfo for more information.
*/
export type DictionaryCellInfo = {
/**
* Hash of the Dictionary cell.
*/
readonly cell: CellHash;
/**
* Offset of the data cell in the Dictionary cell.
*/
readonly offset: number;
/**
* Hash of the data cell.
*/
readonly dataCell: CellHash;
};
/**
* Describes mapping of all cells to their instructions.
*/
export type MappingInfo = {
/**
* Mapping of Dictionary cells to their data cells.
*/
readonly dictionaryCells: readonly DictionaryCellInfo[];
/**
* Mapping of all cells to their instructions.
*/
readonly cells: CellsMapping;
};
/**
* Creates a mapping of all cells to their instructions.
*/
export declare const createMappingInfo: (m: Mapping) => MappingInfo;
//# sourceMappingURL=mapping.d.ts.map