コード例 #1
0
ファイル: AST_Handler.cs プロジェクト: shaneo05/Oversight
        //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;
        }
コード例 #2
0
ファイル: TranslatorContext.cs プロジェクト: fredfeng/verisol
        public void AddFunctionToContract(ContractDefinition contract, FunctionDefinition funcDef)
        {
            if (!ContractToFunctionsMap.ContainsKey(contract))
            {
                Debug.Assert(!ContractToFuncSigsMap.ContainsKey(contract));
                ContractToFunctionsMap[contract] = new HashSet <FunctionDefinition>();
                ContractToFuncSigsMap[contract]  = new HashSet <string>();
            }

            Debug.Assert(!ContractToFunctionsMap[contract].Contains(funcDef), $"Duplicated function definition: {funcDef.Name}");
            ContractToFunctionsMap[contract].Add(funcDef);

            string signature = TransUtils.ComputeFunctionSignature(funcDef);

            Debug.Assert(!ContractToFuncSigsMap[contract].Contains(signature), $"Duplicated function signature: {signature}");
            ContractToFuncSigsMap[contract].Add(signature);

            Debug.Assert(!FunctionToContractMap.ContainsKey(funcDef), $"Duplicated function: {funcDef.Name}");
            FunctionToContractMap[funcDef] = contract;
        }
コード例 #3
0
ファイル: TranslatorContext.cs プロジェクト: fredfeng/verisol
 public ContractDefinition GetContractByFunction(FunctionDefinition funcDef)
 {
     Debug.Assert(FunctionToContractMap.ContainsKey(funcDef));
     return(FunctionToContractMap[funcDef]);
 }