public void Compile()
 {
     if (Attributes.Contains(field.Attributes, "imported"))
     {
         //- do nothing
     }
     else if (field.IsGhost)
     {
         string rw = Attributes.Contains(field.Attributes, "readonly") ? "readonly " : "";
         iwriter.WriteLine(rw + "var " + "$ghost_" + DafnySpec.CleanName(field.Name) + ":"
                           + dafnySpec.TypeString(field.Type) + ";");
     }
     else
     {
         throw new Exception("not implemented: non-ghost global variables");
     }
 }
Beispiel #2
0
    public TypeApply(DafnySpec dafnySpec, string name, List <TypeParameter> typeParams, Dictionary <TypeParameter, Type> typeArgs)
    {
        this.dafnySpec  = dafnySpec;
        this.name       = name;
        this.typeParams = typeParams;
        this.typeArgs   = new Dictionary <TypeParameter, Type>();
        typeArgs.ToList().ForEach(a => this.typeArgs.Add(a.Key, ToType(a.Value)));
        this.typeSubsts = new Dictionary <string, Type>();
        typeArgs.ToList().ForEach(a => this.typeSubsts.Add(a.Key.Name, ToType(a.Value)));

        string suffix = String.Concat(typeParams.Select(p => "___" + dafnySpec.TypeString(typeArgs[p])));

        appName     = name + suffix;
        appFullName = name + "__FULL" + suffix;
        int i = appFullName.Contains('.') ? appFullName.LastIndexOf('.') + 1 : 0;

        appFullName = appFullName.Insert(i, DafnySpec.CleanName("#"));
    }
Beispiel #3
0
 public string GhostVar(string x, bool allowRename = true)
 {
     return((x == "INTERNAL_absMem") ? "$absMem"
         : "$ghost_" + (allowRename && renamer.ContainsKey(x) ? renamer[x] : "") + DafnySpec.CleanName(x));
 }