Esempio n. 1
0
 /**
  * retrieve function defintions using contract as an identifier to traverse the FunctionMapping.
  */
 public HashSet <FunctionDefinition> returnFunctionDefs(ContractDefinition contract)
 {
     if (FunctionMapping.ContainsKey(contract))
     {
         return(FunctionMapping[contract]);
     }
     return(new HashSet <FunctionDefinition>());
 }
Esempio n. 2
0
        //Function to insert a function into the specified contract.
        public void InsertFunctionInContract(ContractDefinition contract, FunctionDefinition funcDef)
        {
            if (FunctionMapping.ContainsKey(contract) == false)
            {
                Debug.Assert(!FunctionSignatureMapping.ContainsKey(contract));
                FunctionMapping[contract]          = new HashSet <FunctionDefinition>();
                FunctionSignatureMapping[contract] = new HashSet <string>();
            }

            Debug.Assert(!FunctionMapping[contract].Contains(funcDef), $"Repeated function warning: {funcDef.Name}");
            FunctionMapping[contract].Add(funcDef);

            string signature = Conversion_Utility_Tool.ComputeFunctionSignature(funcDef);

            FunctionSignatureMapping[contract].Add(signature);

            Debug.Assert(!FunctionToContractMap.ContainsKey(funcDef), $" Repeated function warning: {funcDef.Name}");
            FunctionToContractMap[funcDef] = contract;
        }