Search in sources :

Example 1 with BinaryArgumentPrimitiveTypes

use of cz.cuni.mff.d3s.trupple.language.nodes.utils.BinaryArgumentPrimitiveTypes in project TrufflePascal by Aspect26.

the class BinaryExpressionNode method verifyChildrenNodeTypes.

@Override
public boolean verifyChildrenNodeTypes() {
    TypeDescriptor leftType = getLeftNode().getType();
    TypeDescriptor rightType = getRightNode().getType();
    if (this.typeTable.containsKey(new BinaryArgumentPrimitiveTypes(leftType, rightType))) {
        return true;
    }
    for (BinaryArgumentPrimitiveTypes allowedType : this.typeTable.keySet()) {
        TypeDescriptor allowedLeftType = allowedType.getLeftType();
        TypeDescriptor allowedRightType = allowedType.getRightType();
        if (leftType.convertibleTo(allowedLeftType) && rightType.convertibleTo(allowedRightType)) {
            return true;
        }
    }
    return this.verifyNonPrimitiveArgumentTypes(getLeftNode().getType(), getRightNode().getType());
}
Also used : BinaryArgumentPrimitiveTypes(cz.cuni.mff.d3s.trupple.language.nodes.utils.BinaryArgumentPrimitiveTypes) TypeDescriptor(cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor)

Aggregations

BinaryArgumentPrimitiveTypes (cz.cuni.mff.d3s.trupple.language.nodes.utils.BinaryArgumentPrimitiveTypes)1 TypeDescriptor (cz.cuni.mff.d3s.trupple.parser.identifierstable.types.TypeDescriptor)1