Example #1
0
        public static ICirFunction createTempCirFunctionWithReturnTypeAndArguments(ICirData cirData, CommonIRDumpCommonIRFunctionSigType fsSymbol)
        {
            //String sSymbolDef = fsSymbol.SymbolDef;
            ICirFunction cfCirFunction = new CirFunction {};
           
            //ICirFunction cfCirFunction;
           /* var functionSignature = getSymbol(cirData, sSymbolDef);

            if (cirData.dTemp_Functions_bySymbolDef.ContainsKey(sSymbolDef))
                cfCirFunction = cirData.dTemp_Functions_bySymbolDef[sSymbolDef];                
            else
            {
                cfCirFunction = new CirFunction { SymbolDef = sSymbolDef };
                cirData.dFunctions_bySignature.Add(functionSignature, cfCirFunction);
                cirData.dTemp_Functions_bySymbolDef.Add(sSymbolDef, cfCirFunction);
                //addSymbol(cirData, sSymbolDef, DI.CONST_NEED_SIGNATURE); // create an SymbolRef with no signature
            }
            /*if (cirData.dFunctions_bySymbolDef.ContainsKey(sSymbolDef))            
                cfCirFunction = cirData.dFunctions_bySymbolDef[sSymbolDef];                
            else
            {
                cfCirFunction = new CirFunction { SymbolDef = sSymbolDef };
                cirData.dFunctions_bySignature.Add(functionSignature, cfCirFunction);
                cirData.dFunctions_bySymbolDef.Add(sSymbolDef, cfCirFunction);
                //addSymbol(cirData, sSymbolDef, DI.CONST_NEED_SIGNATURE); // create an SymbolRef with no signature
            }*/
            //if (cfCirFunction.ReturnType == "") // check if these values have been set
            //{
                //cfCirFunction.ReturnType = fsSymbol.ReturnType.SymbolRef;
                cfCirFunction.ReturnType = fsSymbol.ReturnType.PrintableType;            
                //addSymbol(cirData, fsSymbol.ReturnType.SymbolRef, fsSymbol.ReturnType.PrintableType);
                if (fsSymbol.ArgumentTypes != null)
                    foreach (CommonIRDumpCommonIRFunctionSigTypeArgument fsArgumentType in fsSymbol.ArgumentTypes)
                    {
                        if (false == ViewHelpers.getCirParameterTypeStringList(cfCirFunction.FunctionParameters).Contains(fsArgumentType.SymbolRef))
                        // if there are probs with more arguments than reality, i will need to add 
                        // a more thorough check here (one that handles the differences between the first time data is added (which makes it an 'add' ) 
                        // and the 2nd time (which makes it an 'confirm that they are the same' )
                        {
                            cfCirFunction.FunctionParameters.Add(new CirFunctionParameter { ParameterName = "", ParameterType = fsArgumentType.PrintableType });//fsArgumentType.SymbolRef});
                            //addSymbol(cirData, fsArgumentType.SymbolRef, fsArgumentType.PrintableType);
                        }
                    }
            //}
            /*else if (cfCirFunction.ReturnType != fsSymbol.ReturnType.SymbolRef)
                // double check that nothing major is wrong, since these values should match
                DI.log.error(
                    "in addToFunction_ArgumentsAndReturnType, cfCirFunction.ReturnType != fsSymbol.ReturnType.SymbolRef: {0} != {1}",
                    cfCirFunction.ReturnType, fsSymbol.ReturnType.SymbolRef);*/
            return cfCirFunction;
        }
Example #2
0
 public static void mapFunctionsMetadata(ICirData cirData, CommonIRDumpCommonIRFunctionSigType[] afsSymbols)
 {
     if (afsSymbols != null)
     {
         // first get all current mappings on afsSymbols;
         var tempCirFunctions = new Dictionary<string,ICirFunction>();
         foreach (CommonIRDumpCommonIRFunctionSigType fsSymbol in afsSymbols)
         {
             //dSymbols.Add(fsSymbol.SymbolDef, fsSymbol.UniqueID);      // fsSymbol doesn't have the signature just the arguments and returntype
             //                        dSymbols_Function.Add(fsSymbol.SymbolDef, fsSymbol);                        
             tempCirFunctions.Add(fsSymbol.SymbolDef, createTempCirFunctionWithReturnTypeAndArguments(cirData, fsSymbol));
         }
         // then map them to the current functions
         foreach(var cirFunction in cirData.dFunctions_bySignature.Values)
         {
             if (tempCirFunctions.ContainsKey(cirFunction.SymbolDef))
             {
                 cirFunction.ReturnType = tempCirFunctions[cirFunction.SymbolDef].ReturnType;
                 cirFunction.FunctionParameters = tempCirFunctions[cirFunction.SymbolDef].FunctionParameters;                        
             }
         }
     }
 }