UNPKG

@neo-one/smart-contract-compiler

Version:

NEO•ONE TypeScript smart contract compiler.

39 lines (37 loc) 1.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LastProgramCounter = void 0; const ProgramCounter_1 = require("./ProgramCounter"); class LastProgramCounter extends ProgramCounter_1.ProgramCounter { constructor(startPC, offset = 0) { super(); this.startPC = startPC; this.offset = offset; this.mutableChildren = []; } plus(offset) { const pc = new LastProgramCounter(this.startPC, this.offset + offset); this.mutableChildren.push(pc); if (this.mutablePC !== undefined) { pc.setPC(this.mutablePC); } return pc; } equals(other) { return other instanceof LastProgramCounter && this.startPC === other.startPC && this.offset === other.offset; } setPC(pc) { this.mutablePC = pc; this.mutableChildren.forEach((child) => { child.setPC(pc); }); } getPC() { if (this.mutablePC === undefined) { throw new Error('Unknown PC'); } return this.mutablePC + this.offset; } } exports.LastProgramCounter = LastProgramCounter; //# sourceMappingURL=LastProgramCounter.js.map