use of sharpen.xobotos.api.bindings.VariableBinding in project XobotOS by xamarin.
the class SharpenGenerator method mappedVariableType.
@Override
public CSTypeReferenceExpression mappedVariableType(IVariableBinding binding) {
if (binding == null)
return null;
VariableBinding variable = my(BindingManager.class).resolveBinding(binding);
if (variable == null)
return null;
NativeHandle nh = variable.getNativeHandle();
if (nh != null)
return nh.getManagedType();
if (variable.isPointer())
return new CSTypeReference("System.IntPtr");
if (variable.modifyType() != null)
return variable.modifyType().getExpression();
return null;
}
use of sharpen.xobotos.api.bindings.VariableBinding in project XobotOS by xamarin.
the class SharpenGenerator method mappedNullPointer.
@Override
public CSExpression mappedNullPointer(Expression expr) {
VariableBinding variable = lookupVariableBinding(expr);
if (variable != null) {
if (variable.getNativeHandle() != null)
return new CSNullLiteralExpression();
if (variable.isPointer())
return new CSReferenceExpression("System.IntPtr.Zero");
return null;
}
if (expr instanceof MethodInvocation) {
IMethodBinding method = ((MethodInvocation) expr).resolveMethodBinding();
MethodBinding binding = my(BindingManager.class).resolveBinding(method);
if (binding == null)
return null;
if (binding.getNativeHandle() != null)
return new CSNullLiteralExpression();
}
return null;
}
Aggregations