Ejemplo n.º 1
0
        public Variable ToVariable(PluginRoot Plugin, BeginEndMode BEMode = BeginEndMode.Both,
                                   VarDeclConvMode Mode = VarDeclConvMode.Nothing, bool UsePlugin = false, bool Declare = false, bool EnableUntyped = false)
        {
            if (!CheckName(Plugin.State))
            {
                return(null);
            }

            Variable Ret;

            if (UsePlugin)
            {
                Ret = Plugin.CreateVariable(Type, Name);
                if (Ret == null)
                {
                    return(null);
                }

                Ret.InitString = InitString;
                if (Declare && !Plugin.DeclareIdentifier(Ret))
                {
                    return(null);
                }
            }
            else
            {
                Ret = ToVariable(Plugin.Container, Declare);
                if (Ret == null)
                {
                    return(null);
                }
            }

            if (Mode != VarDeclConvMode.Nothing)
            {
                if (!Ret.CalcValue(Plugin, BEMode, Mode == VarDeclConvMode.Assignment, EnableUntyped))
                {
                    return(null);
                }
            }

            return(Ret);
        }