Example #1
0
 public override Expression ReadAddr(Addressable addr)
 {
     if (addr is InstanceField instanceField)
     {
         var fieldName    = FieldTranslator.GetFieldName(instanceField.Field);
         var instanceName = instanceField.Instance.Name;
         if (Settings.SplitFieldsEnabled())
         {
             return(ReadFieldExpression.From(instanceField));
         }
         else
         {
             return(ReadHeapExpression.From(instanceField));
         }
     }
     else if (addr is StaticField staticField)
     {
         return(ReadFieldExpression.From(staticField));
     }
     else if (addr is DotNetVariable v)
     {
         return(BoogieVariable.FromDotNetVariable(v.Var));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Example #2
0
 public override StatementList WriteAddr(Addressable addr, Expression expr)
 {
     if (addr is InstanceField instanceField)
     {
         var instanceName = instanceField.Instance;
         var fieldName    = FieldTranslator.GetFieldName(instanceField.Field);
         if (Settings.SplitFieldsEnabled())
         {
             return(SplitFieldUpdate.ForKeyValue(instanceField, expr));
         }
         else
         {
             return(HeapUpdate.ForKeyValue(instanceField, expr));
         }
     }
     else if (addr is StaticField staticField)
     {
         var boogieVar = BoogieVariable.From(staticField);
         return(bg.VariableAssignment(boogieVar, expr));
     }
     else if (addr is DotNetVariable v)
     {
         return(BoogieStatement.VariableAssignment(BoogieVariable.FromDotNetVariable(v.Var), expr));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Example #3
0
        public override StatementList CallReadArrayElement(IVariable resultVariable, Expression array, Expression index, InstructionTranslator instructionTranslator)
        {
            StatementList stmts = new StatementList();

            return(dispatcher.CallReadArrayElement(BoogieVariable.FromDotNetVariable(resultVariable), array, index));
        }
Example #4
0
 public override StatementList AllocObject(IVariable var, InstructionTranslator instTranslator)
 {
     return(this.AllocObject(BoogieVariable.FromDotNetVariable(var)));
 }