Package org.yinwang.pysonar.ast

Source Code of org.yinwang.pysonar.ast.Yield

package org.yinwang.pysonar.ast;

import org.jetbrains.annotations.NotNull;
import org.yinwang.pysonar.State;
import org.yinwang.pysonar.types.ListType;
import org.yinwang.pysonar.types.Type;


public class Yield extends Node {

    public Node value;


    public Yield(Node n, String file, int start, int end) {
        super(file, start, end);
        this.value = n;
        addChildren(n);
    }


    @NotNull
    @Override
    public Type transform(State s) {
        if (value != null) {
            return new ListType(transformExpr(value, s));
        } else {
            return Type.NONE;
        }
    }


    @NotNull
    @Override
    public String toString() {
        return "<Yield:" + start + ":" + value + ">";
    }

}
TOP

Related Classes of org.yinwang.pysonar.ast.Yield

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.