Exemple #1
0
            /// <summary>
            /// Visitor
            /// </summary>
            /// <param name="typeCobolQualifiedSymbolReference"></param>
            /// <returns></returns>
            public override bool Visit(TypeCobol.Compiler.CodeElements.TypeCobolQualifiedSymbolReference typeCobolQualifiedSymbolReference)
            {   //Yes it has TypeCobol qualifier
                IList <SymbolReference> items = typeCobolQualifiedSymbolReference.AsList();

                if (Items == null)
                {
                    Items = items;
                }
                else
                {
                    //Check if the first element is already in
                    SymbolReference first = items[0];
                    if (Containss(first))
                    {
                        return(true);
                    }
                    if (Contains(first))
                    {
                        foreach (SymbolReference sr in items)
                        {
                            if (!Contains(sr))
                            {
                                Items.Add(sr);
                            }
                        }
                    }
                    else
                    {
                        AllItemsList.Add(Items);
                        Items = items;
                    }
                }
                return(true);
            }
Exemple #2
0
            /// <summary>
            /// Visitor
            /// </summary>
            /// <param name="typeCobolQualifiedSymbolReference"></param>
            /// <returns></returns>
            public override bool Visit(TypeCobol.Compiler.CodeElements.TypeCobolQualifiedSymbolReference typeCobolQualifiedSymbolReference)
            {   //Yes it has TypeCobol qualifier
                IList <SymbolReference> items = typeCobolQualifiedSymbolReference.AsList();

                if (Items == null)
                {
                    Items = items;
                }
                else
                {
                    SymbolReference first = items[0];
                    SymbolReference last  = items[items.Count - 1];
                    if (AllItemsListContains(first))
                    {
                        return(true);
                    }
                    if (ItemsContains(first) || ItemsContains(last))
                    {
                        Items = items;
                    }
                    else
                    {
                        AllItemsList.Add(Items);
                        Items = items;
                    }
                }
                return(true);
            }
Exemple #3
0
 /// <summary>
 /// Checks and handles any procedure call resolution.
 /// </summary>
 /// <param name="items">The items to check if they correspond to the procedure qualified name</param>
 /// <returns>true if it was a Procedure style call, false otherwise.</returns>
 private bool IsProcedureStyleCallItems(IList <SymbolReference> items, out string hashFunction)
 {
     hashFunction = null;
     if (CurrentNode is TypeCobol.Compiler.Nodes.ProcedureStyleCall)
     {
         TypeCobol.Compiler.Nodes.ProcedureStyleCall procStyleCall = CurrentNode as TypeCobol.Compiler.Nodes.ProcedureStyleCall;
         if (procStyleCall.CodeElement is TypeCobol.Compiler.CodeElements.ProcedureStyleCallStatement)
         {
             TypeCobol.Compiler.CodeElements.ProcedureStyleCallStatement procStyleCallStmt =
                 procStyleCall.CodeElement as TypeCobol.Compiler.CodeElements.ProcedureStyleCallStatement;
             if (procStyleCallStmt.ProgramOrProgramEntryOrProcedureOrFunctionOrTCProcedureFunction is
                 TypeCobol.Compiler.CodeElements.TypeCobolQualifiedSymbolReference)
             {
                 TypeCobol.Compiler.CodeElements.TypeCobolQualifiedSymbolReference tcqsr = procStyleCallStmt.ProgramOrProgramEntryOrProcedureOrFunctionOrTCProcedureFunction as
                                                                                           TypeCobol.Compiler.CodeElements.TypeCobolQualifiedSymbolReference;
                 IList <SymbolReference> names_items = tcqsr.AsList();
                 if (names_items.Count != items.Count)
                 {
                     return(false);
                 }
                 if (EqualItems(items, names_items))
                 {//This is a reference to a Function Call.
                     hashFunction = procStyleCall.FunctionDeclaration.Hash;
                     if (ProgramStack != null && ProgramStack.Count > 0)
                     {   //Memoïze the (hash,ProcedureStyleCall) In the Program procedure style call dictionary.
                         var program = ProgramStack.Peek();
                         if (!program.ProcStyleCalls.ContainsKey(hashFunction))
                         {
                             program.ProcStyleCalls[hashFunction] = new Tuple <IList <SymbolReference>, TypeCobol.Compiler.Nodes.ProcedureStyleCall>(items, procStyleCall);
                         }
                     }
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Exemple #4
0
 public virtual bool Visit(TypeCobolQualifiedSymbolReference typeCobolQualifiedSymbolReference)
 {
     return(true);
 }
Exemple #5
0
 public override bool Visit(TypeCobolQualifiedSymbolReference typeCobolQualifiedSymbolReference)
 {
     NeedGeneration = true;
     return(false);
 }