示例#1
0
        static bool CallStaticConstructors(IdContainer Container, CodeScopeNode Scope, PluginRoot Plugin, CodeString Code)
        {
            for (var i = 0; i < Container.Children.Count; i++)
            {
                if (!CallStaticConstructors(Container.Children[i], Scope, Plugin, Code))
                {
                    return(false);
                }
            }

            for (var i = 0; i < Container.IdentifierList.Count; i++)
            {
                var Ctor = Container.IdentifierList[i] as Constructor;
                if (Ctor == null || (Ctor.Flags & IdentifierFlags.Static) == 0)
                {
                    continue;
                }

                if (!Plugin.Begin())
                {
                    return(false);
                }

                var CtorNode = Plugin.NewNode(new IdExpressionNode(Ctor, Code));
                if (CtorNode == null)
                {
                    Plugin.Reset(); return(false);
                }

                var NodeCh = new ExpressionNode[] { CtorNode };
                var Node   = Plugin.NewNode(new OpExpressionNode(Operator.Call, NodeCh, Code));
                if (Node == null || Plugin.End(ref Node) == PluginResult.Failed)
                {
                    Plugin.Reset(); return(false);
                }

                Scope.Children.Add(new Command(Scope, Code, CommandType.Expression)
                {
                    Expressions = new List <ExpressionNode>()
                    {
                        Node
                    },
                });
            }

            return(true);
        }
示例#2
0
        public FunctionParameter[] ToFuncParams(PluginRoot Plugin, VarDeclConvMode Mode = VarDeclConvMode.Nothing)
        {
            var Ret = new FunctionParameter[Count];

            for (var i = 0; i < Count; i++)
            {
                Plugin.Reset();
                Ret[i] = this[i].ToFuncParam(Plugin, Mode);
            }

            return(Ret);
        }
示例#3
0
        public Variable[] ToVariables(PluginRoot Plugin, BeginEndMode BEMode = BeginEndMode.Both,
                                      VarDeclConvMode Mode = VarDeclConvMode.Nothing, bool UsePlugin = false, bool Declare = false, bool EnableUntyped = false)
        {
            var Ret = new Variable[Count];

            for (var i = 0; i < Count; i++)
            {
                if ((BEMode & BeginEndMode.Begin) != 0)
                {
                    Plugin.Reset();
                }
                Ret[i] = this[i].ToVariable(Plugin, BEMode, Mode, UsePlugin, Declare, EnableUntyped);
            }

            return(Ret);
        }