Search in sources :

Example 1 with BLangIsAssignableExpr

use of org.wso2.ballerinalang.compiler.tree.expressions.BLangIsAssignableExpr in project ballerina by ballerina-lang.

the class CodeGenerator method visit.

@Override
public void visit(BLangIsAssignableExpr assignableExpr) {
    genNode(assignableExpr.lhsExpr, this.env);
    RegIndex regIndex = calcAndGetExprRegIndex(assignableExpr);
    Operand typeCPIndex = getTypeCPIndex(assignableExpr.targetType);
    emit(assignableExpr.opSymbol.opcode, assignableExpr.lhsExpr.regIndex, typeCPIndex, regIndex);
}
Also used : Operand(org.wso2.ballerinalang.programfile.Instruction.Operand) RegIndex(org.wso2.ballerinalang.programfile.Instruction.RegIndex)

Example 2 with BLangIsAssignableExpr

use of org.wso2.ballerinalang.compiler.tree.expressions.BLangIsAssignableExpr in project ballerina by ballerina-lang.

the class ASTBuilderUtil method createIsAssignableExpr.

static BLangIsAssignableExpr createIsAssignableExpr(DiagnosticPos pos, BLangExpression lhsExpr, BType targetType, BType type, Names names) {
    final BLangIsAssignableExpr assignableExpr = new BLangIsAssignableExpr();
    assignableExpr.pos = pos;
    assignableExpr.lhsExpr = lhsExpr;
    assignableExpr.targetType = targetType;
    assignableExpr.type = type;
    assignableExpr.opSymbol = new BOperatorSymbol(names.fromString(assignableExpr.opKind.value()), null, targetType, null, InstructionCodes.IS_ASSIGNABLE);
    return assignableExpr;
}
Also used : BLangIsAssignableExpr(org.wso2.ballerinalang.compiler.tree.expressions.BLangIsAssignableExpr) BOperatorSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BOperatorSymbol)

Aggregations

BOperatorSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BOperatorSymbol)1 BLangIsAssignableExpr (org.wso2.ballerinalang.compiler.tree.expressions.BLangIsAssignableExpr)1 Operand (org.wso2.ballerinalang.programfile.Instruction.Operand)1 RegIndex (org.wso2.ballerinalang.programfile.Instruction.RegIndex)1