Ejemplo n.º 1
0
        public ProcedureDivision(Compiler.Nodes.FunctionDeclaration declaration, [NotNull] List <Compiler.Nodes.Node> sentences) : base(null)
        {
            table           = declaration.SymbolTable;
            UsingParameters = new List <CallTargetParameter>();
            // TCRFUN_CODEGEN_PARAMETERS_ORDER
            foreach (var parameter in declaration.Profile.InputParameters)
            {
                if (parameter.LevelNumber.Value == 1)
                {
                    UsingParameters.Add(new GeneratedParameter(parameter.DataName));
                }
            }
            foreach (var parameter in declaration.Profile.InoutParameters)
            {
                if (parameter.LevelNumber.Value == 1)
                {
                    UsingParameters.Add(new GeneratedParameter(parameter.DataName));
                }
            }
            foreach (var parameter in declaration.Profile.OutputParameters)
            {
                if (parameter.LevelNumber.Value == 1)
                {
                    UsingParameters.Add(new GeneratedParameter(parameter.DataName));
                }
            }
            // TCRFUN_CODEGEN_RETURNING_PARAMETER
            if (declaration.Profile.ReturningParameter != null)
            {
                if (declaration.Profile.ReturningParameter.LevelNumber.Value == 1)
                {
                    ReturningParameter = new CallTargetParameter()
                    {
                        StorageArea = GeneratedParameter.CreateReceivingStorageArea(declaration.Profile.ReturningParameter.DataName)
                    }
                }
            }
            ;

            this.children.AddRange(sentences);

            var signature = new List <TextLineSnapshot>();

            signature.Add(new TextLineSnapshot(-1,
                                               string.Format("*{0}.{1} {2}", declaration.Root.MainProgram.Name, declaration.Name,
                                                             declaration.Profile.Parameters.Count != 0 ? "- Params :" : " - No Params"), null));
            signature.AddRange(declaration.Profile.GetSignatureForComment());

            Signature = signature;
        }
Ejemplo n.º 2
0
        public ProcedureDivision(Compiler.Nodes.FunctionDeclaration declaration, List <Compiler.Nodes.Node> sentences) : base(null)
        {
            table           = declaration.SymbolTable;
            UsingParameters = new List <CallTargetParameter>();
            // TCRFUN_CODEGEN_PARAMETERS_ORDER
            foreach (var parameter in declaration.Profile.InputParameters)
            {
                if (parameter.LevelNumber.Value == 1)
                {
                    UsingParameters.Add(new GeneratedParameter(parameter.DataName));
                }
            }
            foreach (var parameter in declaration.Profile.InoutParameters)
            {
                if (parameter.LevelNumber.Value == 1)
                {
                    UsingParameters.Add(new GeneratedParameter(parameter.DataName));
                }
            }
            foreach (var parameter in declaration.Profile.OutputParameters)
            {
                if (parameter.LevelNumber.Value == 1)
                {
                    UsingParameters.Add(new GeneratedParameter(parameter.DataName));
                }
            }
            // TCRFUN_CODEGEN_RETURNING_PARAMETER
            if (declaration.Profile.ReturningParameter != null)
            {
                if (declaration.Profile.ReturningParameter.LevelNumber.Value == 1)
                {
                    ReturningParameter = new CallTargetParameter()
                    {
                        StorageArea = GeneratedParameter.CreateReceivingStorageArea(declaration.Profile.ReturningParameter.DataName)
                    }
                }
            }
            ;

            this.children.AddRange(sentences);
        }