コード例 #1
0
 public string GetNestedAllocName(VariableDeclaration decl, int lvl)
 {
     return("alloc_" + TransUtils.GetCanonicalVariableName(decl, context) + "_lvl" + lvl);
 }
コード例 #2
0
 public string GetMultiDimLengthName(VariableDeclaration varDecl, int lvl)
 {
     return($"Length_{TransUtils.GetCanonicalVariableName(varDecl, context)}_lvl{lvl}");
 }
コード例 #3
0
        private BoogieIfCmd GenerateChoices(ContractDefinition contract)
        {
            BoogieExpr thisVal = new BoogieIdentifierExpr("this");
            Tuple <BoogieIfCmd, int> curChoices = TransUtils.GeneratePartialChoiceBlock(new List <ContractDefinition>()
            {
                contract
            }, context, thisVal, 0, context.TranslateFlags.ModelReverts);

            if (context.TranslateFlags.TxnsOnFields)
            {
                HashSet <VariableDeclaration> contractFields = context.GetStateVarsByContract(contract);

                foreach (VariableDeclaration contractField in contractFields)
                {
                    if (contractField.TypeDescriptions.IsContract() && contractField.TypeName is UserDefinedTypeName)
                    {
                        BoogieExpr         fieldInstance     = new BoogieMapSelect(new BoogieIdentifierExpr(TransUtils.GetCanonicalVariableName(contractField, context)), thisVal);
                        String             fieldContractName = contractField.TypeName.ToString();
                        ContractDefinition fieldDef          = context.GetContractByName(fieldContractName);
                        curChoices = TransUtils.GeneratePartialChoiceBlock(new List <ContractDefinition>()
                        {
                            fieldDef
                        },
                                                                           context, fieldInstance, curChoices.Item2, context.TranslateFlags.ModelReverts, curChoices.Item1);
                    }
                }
            }

            return(curChoices.Item1);
        }