use of org.wso2.ballerinalang.compiler.tree.types.BLangUserDefinedType in project ballerina by ballerina-lang.
the class ParserUtils method getReceiverType.
/**
* Extract receiverType from the function receiver.
*
* @param receiver receiver
* @return receiverType
*/
private static String getReceiverType(VariableNode receiver) {
if (receiver == null) {
return null;
}
TypeNode typeNode = receiver.getTypeNode();
String receiverType = null;
if (typeNode instanceof BLangUserDefinedType) {
receiverType = ((BLangUserDefinedType) typeNode).getTypeName().getValue();
} else if (typeNode instanceof BLangBuiltInRefTypeNode) {
receiverType = ((BLangBuiltInRefTypeNode) typeNode).getTypeKind().typeName();
} else if (typeNode instanceof BLangValueType) {
receiverType = ((BLangValueType) typeNode).getTypeKind().typeName();
} else {
return null;
}
return receiverType;
}
Aggregations