public ReferenceExpression CreateReference(InternalParameter parameter) { return(new ReferenceExpression(parameter.Name) { Entity = parameter, ExpressionType = parameter.Type }); }
public ReferenceExpression CreateReference(InternalParameter parameter) { ReferenceExpression reference = new ReferenceExpression(parameter.Name); reference.Entity = parameter; reference.ExpressionType = parameter.Type; return(reference); }
public override void LeaveCallableTypeReference(CallableTypeReference node) { IParameter[] parameters = new IParameter[node.Parameters.Count]; for (int i=0; i<parameters.Length; ++i) { parameters[i] = new InternalParameter(node.Parameters[i], i); } IType returnType = null; if (null != node.ReturnType) { returnType = GetType(node.ReturnType); } else { returnType = TypeSystemServices.VoidType; } node.Entity = TypeSystemServices.GetConcreteCallableType(node, new CallableSignature(parameters, returnType)); }
private CallableSignature CallableSignatureFor(CallableTypeReference node) { var parameters = new IParameter[node.Parameters.Count]; for (int i=0; i<parameters.Length; ++i) parameters[i] = new InternalParameter(node.Parameters[i], i); var returnType = node.ReturnType != null ? GetType(node.ReturnType) : TypeSystemServices.VoidType; return new CallableSignature(parameters, returnType, node.Parameters.HasParamArray); }
private void SetByRefParam(InternalParameter param, Expression right, bool leaveValueOnStack) { LocalBuilder temp = null; IType tempType = null; if (leaveValueOnStack) { Visit(right); tempType = PopType(); temp = StoreTempLocal(tempType); } LoadParam(param); if (temp != null) { LoadLocal(temp, tempType); } else { Visit(right); } EmitCastIfNeeded(param.Type, PopType()); OpCode storecode = GetStoreRefParamCode(param.Type); if (IsStobj(storecode)) //passing struct/decimal byref { _il.Emit(storecode, GetSystemType(param.Type)); } else { _il.Emit(storecode); } if (null != temp) { LoadLocal(temp, tempType); } }
void LoadParam(InternalParameter param) { int index = param.Index; switch (index) { case 0: { _il.Emit(OpCodes.Ldarg_0); break; } case 1: { _il.Emit(OpCodes.Ldarg_1); break; } case 2: { _il.Emit(OpCodes.Ldarg_2); break; } case 3: { _il.Emit(OpCodes.Ldarg_3); break; } default: { if (index < 256) { _il.Emit(OpCodes.Ldarg_S, index); } else { _il.Emit(OpCodes.Ldarg, index); } break; } } }
public ReferenceExpression CreateReference(InternalParameter parameter) { ReferenceExpression reference = new ReferenceExpression(parameter.Name); reference.Entity = parameter; reference.ExpressionType = parameter.Type; return reference; }