@awayfl/avm2
Version:
Virtual machine for executing AS3 code
32 lines (31 loc) • 1.41 kB
JavaScript
import { Bytecode } from './../Bytecode';
var DEFAULT_STACK_INDEX = -1024;
var Instruction = /** @class */ (function () {
function Instruction(position, name, params, delta, deltaScope, terminal, refs) {
if (params === void 0) { params = null; }
if (delta === void 0) { delta = 0; }
if (deltaScope === void 0) { deltaScope = 0; }
if (terminal === void 0) { terminal = false; }
if (refs === void 0) { refs = []; }
this.position = position;
this.name = name;
this.params = params;
this.delta = delta;
this.deltaScope = deltaScope;
this.terminal = terminal;
this.refs = refs;
this.stack = DEFAULT_STACK_INDEX;
this.scope = DEFAULT_STACK_INDEX;
this.catchStart = false;
this.catchEnd = false;
this.returnTypeId = -1; // void
this.childs = [];
this.comment = null;
}
Instruction.prototype.toString = function () {
// eslint-disable-next-line max-len
return "Instruction(".concat(this.position, ", ").concat(Bytecode[this.name], " (").concat(this.name, "), [").concat(this.params, "], ").concat(this.stack, " -> ").concat(this.stack + this.delta, ", ").concat(this.scope, " -> ").concat(this.scope + this.deltaScope, ", ").concat(this.terminal, ", [").concat(this.refs, "])");
};
return Instruction;
}());
export { Instruction };