UNPKG

@sudoo/marked

Version:

JavaScript & TypeScript code runner in JavaScript, safe with marked territory, asynchronous

70 lines (69 loc) 1.84 kB
"use strict"; /** * @author WMXPY * @namespace Variable * @description Flag */ Object.defineProperty(exports, "__esModule", { value: true }); exports.Flag = void 0; const variable_1 = require("../declare/variable"); class Flag { static fromReturn(trace) { return new Flag(variable_1.FLAG_TYPE.RETURN, trace); } static fromRootReturn(trace) { return new Flag(variable_1.FLAG_TYPE.ROOT_RETURN, trace); } static fromBreak(trace) { return new Flag(variable_1.FLAG_TYPE.BREAK, trace); } static fromContinue(trace) { return new Flag(variable_1.FLAG_TYPE.CONTINUE, trace); } static fromThrow(trace) { return new Flag(variable_1.FLAG_TYPE.THROW, trace); } static fromFatal(trace) { return new Flag(variable_1.FLAG_TYPE.FATAL, trace); } static fromTerminate(trace) { return new Flag(variable_1.FLAG_TYPE.TERMINATE, trace); } constructor(type, trace) { this._type = type; this._value = null; this._trace = trace; } get trace() { return this._trace; } setValue(value) { this._value = value; return this; } getValue() { return this._value; } isReturn() { return this._type === variable_1.FLAG_TYPE.RETURN; } isRootReturn() { return this._type === variable_1.FLAG_TYPE.ROOT_RETURN; } isBreak() { return this._type === variable_1.FLAG_TYPE.BREAK; } isContinue() { return this._type === variable_1.FLAG_TYPE.CONTINUE; } isThrow() { return this._type === variable_1.FLAG_TYPE.THROW; } isFatal() { return this._type === variable_1.FLAG_TYPE.FATAL; } isTerminate() { return this._type === variable_1.FLAG_TYPE.TERMINATE; } } exports.Flag = Flag;