All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alibaba.qlexpress4.runtime.instruction.CloseScopeInstruction Maven / Gradle / Ivy

package com.alibaba.qlexpress4.runtime.instruction;

import com.alibaba.qlexpress4.QLOptions;
import com.alibaba.qlexpress4.exception.ErrorReporter;
import com.alibaba.qlexpress4.runtime.QContext;
import com.alibaba.qlexpress4.runtime.QResult;
import com.alibaba.qlexpress4.utils.PrintlnUtils;

import java.util.function.Consumer;

/**
 * Operation: close scope
 * Input: 0
 * Output: 0
 *
 * Author: DQinYuan
 */
public class CloseScopeInstruction extends QLInstruction {

    private final String scopeName;

    public CloseScopeInstruction(ErrorReporter errorReporter, String scopeName) {
        super(errorReporter);
        this.scopeName = scopeName;
    }

    @Override
    public QResult execute(QContext qContext, QLOptions qlOptions) {
        qContext.closeScope();
        return QResult.NEXT_INSTRUCTION;
    }

    @Override
    public int stackInput() {
        return 0;
    }

    @Override
    public int stackOutput() {
        return 0;
    }

    @Override
    public void println(int index, int depth, Consumer debug) {
        PrintlnUtils.printlnByCurDepth(depth, index + ": CloseScope " + scopeName, debug);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy