import { immutable } from '../../decorators'; import { ExpressionNode, LOGIC_TYPE } from '../LogicItem'; /** * 逻辑二元表达式 * @TODO: 当前类目前主要用于生成文档 */ export class LogicalExpression extends ExpressionNode { /** * 逻辑节点类型 */ @immutable() public readonly type: LOGIC_TYPE = LOGIC_TYPE.LogicalExpression; /** * 左边项 */ @immutable() public readonly left: ExpressionNode = undefined; /** * 右边项 */ @immutable() public readonly right: ExpressionNode = undefined; /** * 运算符 */ @immutable() public readonly operator: string = undefined; /** * 生成 JS 脚本 */ toScript() { return `${this.left.toScript()} ${this.operator} ${this.right.toScript()}`; } }