LocalInitedFromStack() private method

private LocalInitedFromStack ( System type ) : ContextualOperand
type System
return ContextualOperand
Example #1
0
            public override void Emit(CodeGen g, Type from, Type to)
            {
                var l = g.LocalInitedFromStack(from);

                Type toUnderlying   = Helpers.GetNullableUnderlyingType(to);
                Type fromUnderlying = Helpers.GetNullableUnderlyingType(from);
                var  cond           = new Conditional(
                    l.Property("HasValue"),
                    new NewObject(
                        g.TypeMapper.TypeInfo.FindConstructor(to, new Operand[] { new FakeTypedOperand(toUnderlying), }),
                        new Operand[] { new ConversationWrapper(_internalConversation, l.Property("Value"), fromUnderlying, toUnderlying) }),
                    new DefaultValue(to));


                //GetImplicit(l.Property("Value"), toUnderlying, false, g.TypeMapper), l, from, toUnderlying
                cond.EmitGet(g);
            }
Example #2
0
		    public override void Emit(CodeGen g, Type from, Type to)
		    {
		        var l = g.LocalInitedFromStack(from);

		        Type toUnderlying = Helpers.GetNullableUnderlyingType(to);
		        Type fromUnderlying = Helpers.GetNullableUnderlyingType(from);
		        var cond = new Conditional(
		            l.Property("HasValue"),
		            new NewObject(
		                g.TypeMapper.TypeInfo.FindConstructor(to, new Operand[] { new FakeTypedOperand(toUnderlying), }),
		                new Operand[] { new ConversationWrapper(_internalConversation, l.Property("Value"), fromUnderlying, toUnderlying) }),
		            new DefaultValue(to));


		        //GetImplicit(l.Property("Value"), toUnderlying, false, g.TypeMapper), l, from, toUnderlying
		        cond.EmitGet(g);
		    }