Esempio n. 1
0
        public static string CreateDefaultValuesStaticVariablesProcedure()
        {
            #region Create body of the procedure
            StatementList body = new StatementList();

            foreach (IFieldReference field in FieldTranslator.GetFieldReferences())
            {
                if (field.IsStatic)
                {
                    BoogieGenerator   bg = BoogieGenerator.Instance();
                    StaticFieldAccess staticFieldAccess = new StaticFieldAccess(field);

                    body.Add(bg.WriteStaticField(staticFieldAccess, GetDefaultConstant(Helpers.GetBoogieType(field.Type))));
                }
            }
            #endregion

            string        procedureName       = "$default_values_static_fields";
            string        attributes          = String.Empty;
            StatementList localVariables      = new StatementList();
            String        parametersWithTypes = String.Empty;
            String        returnTypeIfAny     = String.Empty;

            BoogieProcedureTemplate temp = new BoogieProcedureTemplate(procedureName, attributes, localVariables, body, parametersWithTypes, returnTypeIfAny, false);
            return(temp.TransformText());
        }
Esempio n. 2
0
        public static string CreateStaticVariablesAllocProcedure()
        {
            string        procedureName       = "$allocate_static_fields";
            string        attributes          = String.Empty;
            StatementList body                = BoogieGenerator.Instance().AllocStaticVariables();
            StatementList localVariables      = new StatementList();
            String        parametersWithTypes = String.Empty;
            String        returnTypeIfAny     = String.Empty;

            BoogieProcedureTemplate temp = new BoogieProcedureTemplate(procedureName, attributes, localVariables, body, parametersWithTypes, returnTypeIfAny, false);

            return(temp.TransformText());
        }
Esempio n. 3
0
        public static string CreateStaticConstructorsCallsProcedure()
        {
            StatementList body = new StatementList();

            foreach (var staticConstructor in staticConstructors)
            {
                var ctor = BoogieMethod.From(staticConstructor);
                body.Add(BoogieGenerator.Instance().ProcedureCall(ctor, new List <Expression>(), null));
            }

            string        procedureName       = "$call_static_constructors";
            string        attributes          = String.Empty;
            StatementList localVariables      = new StatementList();
            String        parametersWithTypes = String.Empty;
            String        returnTypeIfAny     = String.Empty;

            BoogieProcedureTemplate temp = new BoogieProcedureTemplate(procedureName, attributes, localVariables, body, parametersWithTypes, returnTypeIfAny, false);

            return(temp.TransformText());
        }