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

webit.script.core.ast.statements.Break Maven / Gradle / Ivy

The newest version!
// Copyright (c) 2013-2014, Webit Team. All Rights Reserved.
package webit.script.core.ast.statements;

import java.util.LinkedList;
import java.util.List;
import webit.script.Context;
import webit.script.core.LoopInfo;
import webit.script.core.ast.Loopable;
import webit.script.core.ast.Statement;

/**
 *
 * @author Zqq
 */
public final class Break extends Statement implements Loopable {

    private final int label;

    public Break(int label, int line, int column) {
        super(line, column);
        this.label = label;
    }

    public Object execute(final Context context) {
        context.breakLoop(label);
        return null;
    }

    public List collectPossibleLoopsInfo() {
        LinkedList list;
        (list = new LinkedList()).add(new LoopInfo(LoopInfo.BREAK, label, line, column));
        return list;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy