public static CompositeConversionAction Make(RubyContext context, CompositeConversion conversion) { switch (conversion) { case CompositeConversion.ToFixnumToStr: return new CompositeConversionAction(conversion, typeof(Union<int, MutableString>), ConvertToFixnumAction.Make(context), ConvertToStrAction.Make(context) ); case CompositeConversion.ToStrToFixnum: return new CompositeConversionAction(conversion, typeof(Union<MutableString, int>), ConvertToStrAction.Make(context), ConvertToFixnumAction.Make(context) ); case CompositeConversion.ToIntToI: return new CompositeConversionAction(conversion, typeof(IntegerValue), ConvertToIntAction.Make(context), ConvertToIAction.Make(context) ); case CompositeConversion.ToAryToInt: return new CompositeConversionAction(conversion, typeof(Union<IList, int>), ConvertToArrayAction.Make(context), ConvertToFixnumAction.Make(context) ); default: throw Assert.Unreachable; } }
public static CompositeConversionAction Make(RubyContext context, CompositeConversion conversion) { switch (conversion) { case CompositeConversion.ToFixnumToStr: return(new CompositeConversionAction(conversion, typeof(Union <int, MutableString>), ConvertToFixnumAction.Make(context), ConvertToStrAction.Make(context) )); case CompositeConversion.ToStrToFixnum: return(new CompositeConversionAction(conversion, typeof(Union <MutableString, int>), ConvertToStrAction.Make(context), ConvertToFixnumAction.Make(context) )); case CompositeConversion.ToIntToI: return(new CompositeConversionAction(conversion, typeof(IntegerValue), ConvertToIntAction.Make(context), ConvertToIAction.Make(context) )); case CompositeConversion.ToAryToInt: return(new CompositeConversionAction(conversion, typeof(Union <IList, int>), ConvertToArrayAction.Make(context), ConvertToFixnumAction.Make(context) )); default: throw Assert.Unreachable; } }
private CompositeConversionAction(CompositeConversion conversion, Type/*!*/ resultType, params ProtocolConversionAction[]/*!*/ conversions) : base(conversions[0].Context) { Assert.NotNullItems(conversions); Assert.NotEmpty(conversions); _conversions = conversions; _conversion = conversion; _resultType = resultType; }
private CompositeConversionAction(CompositeConversion conversion, Type /*!*/ resultType, params ProtocolConversionAction[] /*!*/ conversions) : base(conversions[0].Context) { Assert.NotNullItems(conversions); Assert.NotEmpty(conversions); _conversions = conversions; _conversion = conversion; _resultType = resultType; }
public CompositeConversionAction /*!*/ CompositeConversion(CompositeConversion conversion) { var key = conversion; lock (_conversionActions) { CompositeConversionAction result; if (!_compositeConversionActions.TryGetValue(key, out result)) { _compositeConversionActions.Add(key, result = CompositeConversionAction.Make(_context, conversion)); } return(result); } }
public static CompositeConversionAction/*!*/ MakeShared(CompositeConversion conversion) { return Make(null, conversion); }
public static CompositeConversionAction /*!*/ MakeShared(CompositeConversion conversion) { return(Make(null, conversion)); }