Exemplo n.º 1
0
        static bool ImplicitFundamentalConversionExists(ScriptingContext context,
								 TargetFundamentalType source,
								 TargetFundamentalType target)
        {
            return ImplicitFundamentalConversionExists (
                source.FundamentalKind, target.FundamentalKind);
        }
Exemplo n.º 2
0
        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;
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 internal TargetFundamentalObject(TargetFundamentalType type, TargetLocation location)
     : base(type, location)
 {
     this.Type = type;
 }