Package org.yinwang.pysonar.ast

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

package org.yinwang.pysonar.ast;

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

import java.util.List;


public class Dict extends Node {

    public List<Node> keys;
    public List<Node> values;


    public Dict(List<Node> keys, List<Node> values, String file, int start, int end) {
        super(file, start, end);
        this.keys = keys;
        this.values = values;
        addChildren(keys);
        addChildren(values);
    }


    @NotNull
    @Override
    public Type transform(State s) {
        Type keyType = resolveUnion(keys, s);
        Type valType = resolveUnion(values, s);
        return new DictType(keyType, valType);
    }


    @NotNull
    @Override
    public String toString() {
        return "<Dict>";
    }

}
TOP

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

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.