public EmitSyntax Clear(EmitSyntax emit) { return emit .Ldc_I4_0() .Stloc(index.GetRef()) ; }
public EmitSyntax Clear(EmitSyntax emit) { return(emit .Ldc_I4_0() .Stloc(index.GetRef()) ); }
private EmitSyntax EmitFactoryCode( EmitSyntax emit, PlannedClass contextPlannedClass, Type type, bool nullAllowed) { if (type == typeof(void)) { } else if (type == typeof(int)) { emit = emit.Ldc_I4_0(); } else if (type.IsValueType) { var resultType = emit.Types.Import(type); var resultLoc = emit.Locals.Generate("result"); emit = emit .Local(resultLoc, resultType) .Ldloca(resultLoc.GetRef()) .Initobj(resultType) .Ldloc(resultLoc.GetRef()) ; } else if (nullAllowed) { emit.Ldnull(); } else if (!type.IsAbstract && !type.IsInterface) { emit = emit.Newobj( emit.Types.Import(type)); } else if (contextPlannedClass != null && contextPlannedClass.Implements(type)) { emit = emit.Ldarg(0); } else if (plan.Exists(e => e.Implements(type))) { var otherEntry = plan.Find(e => e.Implements(type)); emit = emit.Newobj( emit.Types.Class_( ClassName.Parse( otherEntry.ClassName))); } else { throw new InvalidOperationException( "Internal error: non-planned abstract result type"); } return(emit); }
public EmitSyntax Init(EmitSyntax emit) { emit = emit .Ldc_I4_0() .Stloc(index.GetRef()) ; if (!nullContainer) { emit = emit .Ldc_I4(this.stackSize) .Newarr(itemType) .Stloc(stack.GetRef()) ; } return emit; }
public EmitSyntax Init(EmitSyntax emit) { emit = emit .Ldc_I4_0() .Stloc(index.GetRef()) ; if (!nullContainer) { emit = emit .Ldc_I4(this.stackSize) .Newarr(itemType) .Stloc(stack.GetRef()) ; } return(emit); }
private EmitSyntax EmitFactoryCode( EmitSyntax emit, PlannedClass contextPlannedClass, Type type, bool nullAllowed) { if (type == typeof(void)) { } else if (type == typeof(int)) { emit = emit.Ldc_I4_0(); } else if (type.IsValueType) { var resultType = emit.Types.Import(type); var resultLoc = emit.Locals.Generate("result"); emit = emit .Local(resultLoc, resultType) .Ldloca(resultLoc.GetRef()) .Initobj(resultType) .Ldloc(resultLoc.GetRef()) ; } else if (nullAllowed) { emit.Ldnull(); } else if (!type.IsAbstract && !type.IsInterface) { emit = emit.Newobj( emit.Types.Import(type)); } else if (contextPlannedClass != null && contextPlannedClass.Implements(type)) { emit = emit.Ldarg(0); } else if (plan.Exists(e => e.Implements(type))) { var otherEntry = plan.Find(e => e.Implements(type)); emit = emit.Newobj( emit.Types.Class_( ClassName.Parse( otherEntry.ClassName))); } else { throw new InvalidOperationException( "Internal error: non-planned abstract result type"); } return emit; }