static bool ImplicitFundamentalConversionExists(ScriptingContext context, TargetFundamentalType source, TargetFundamentalType target) { return ImplicitFundamentalConversionExists ( source.FundamentalKind, target.FundamentalKind); }
public static TargetObject ExplicitFundamentalConversion(ScriptingContext context, TargetFundamentalObject obj, TargetFundamentalType type) { TargetObject retval = ImplicitFundamentalConversion (context, obj, type); if (retval != null) return retval; FundamentalKind tkind = type.FundamentalKind; try { object value = obj.GetObject (context.CurrentThread); object new_value = ImplicitFundamentalConversion (value, tkind); if (new_value == null) return null; return type.Language.CreateInstance (context.CurrentThread, new_value); } catch { return null; } }
static TargetObject ImplicitFundamentalConversion(ScriptingContext context, TargetFundamentalObject obj, TargetFundamentalType type) { FundamentalKind skind = obj.Type.FundamentalKind; FundamentalKind tkind = type.FundamentalKind; if (!ImplicitFundamentalConversionExists (skind, tkind)) return null; object value = obj.GetObject (context.CurrentThread); object new_value = ImplicitFundamentalConversion (value, tkind); if (new_value == null) return null; return type.Language.CreateInstance (context.CurrentThread, new_value); }
internal TargetFundamentalObject(TargetFundamentalType type, TargetLocation location) : base(type, location) { this.Type = type; }