UNPKG

@awayfl/avm2

Version:

Virtual machine for executing AS3 code

21 lines (20 loc) 674 B
export function emitInlineLocal(_state, n) { if (_state.canUseRealThis && n === 0) return 'this'; return n === 0 ? '_this' : 'local' + n; } export var UNDERRUN = '[stack underrun]'; export function emitInlineStack(_state, n, useAlias) { if (useAlias === void 0) { useAlias = true; } var mapped = _state.evalStackIndex(n); if (mapped < 0) { return "/*".concat(UNDERRUN, " ").concat(mapped, "*/ null"); } var alias = 'stack' + (mapped); if (!useAlias) { return alias; } if (_state.isThisAlias(alias)) return emitInlineLocal(_state, 0); // this ALWAYS is local 0 return _state.getConstAlias(alias); }