Beispiel #1
0
 public TypeNode ApplySignature(TypeNode type) {
   foreach (var sig in this.signature)
     switch (sig) {
       case ByRefSignature:
         type = type.GetReferenceType();
         break;
       case PointerSignature:
         type = type.GetPointerType();
         break;
       case SzArraySignature:
         type = type.GetArrayType(1);
         break;
       default:
         type = type.GetArrayType(sig, true);
         break;
     }
   return type;
 }
Beispiel #2
0
 private static Expression/*!*/ ParseTypeCheck(Expression operand, TypeNode type, NodeType typeOfCheck) {
   TypeNode etype = type;
   if (typeOfCheck == NodeType.Unbox) etype = type.GetReferenceType();
   Expression expr = new BinaryExpression(operand, new Literal(type, CoreSystemTypes.Type), typeOfCheck, etype);
   return expr;
 }
Beispiel #3
0
    private TypeNode GetThisTypeInstance(TypeNode templateType, TypeNode wrapperType, TypeNode constraintTypeParam)
    {
      if (constraintTypeParam != null) {
        return constraintTypeParam.GetReferenceType();
      }
      TypeNode thisType = templateType;
      if (thisType.TemplateParameters != null && thisType.TemplateParameters.Count > 0) {
        // need selfinstantiation
        thisType = thisType.GetGenericTemplateInstance(this.assemblyBeingRewritten, wrapperType.ConsolidatedTemplateParameters);
      }

      if (templateType.IsValueType) {
        thisType = thisType.GetReferenceType();
      }
      return thisType;
    }