예제 #1
0
        protected override void GenerateConvertGlobalStaticVar_LH()
        {
            if (!canHideTau)
            {
                base.GenerateConvertGlobalStaticVar_LH();
                return;
            }

            var es = new List <string>();

            foreach (var varName in hiddenVariables)
            {
                var gv = pgp.symbolsLow.Globals.Lookup(varName);
                if (gv is GlobalUnaddressableArmadaVariable)
                {
                    es.Add($"!v.Armada_GlobalStaticVar_{varName}?");
                }
            }

            var fn = $@"
        predicate CanConvertGlobalStaticVar_LH(v: L.Armada_GlobalStaticVar)
        {{
          {AH.CombineStringsWithAnd(es)}
        }}
      ";

            pgp.AddPredicate(fn, "convert");

            var caseBodies = "case Armada_GlobalStaticVarNone => H.Armada_GlobalStaticVarNone\n";

            foreach (var varName in pgp.symbolsLow.Globals.VariableNames)
            {
                if (hiddenVariables.Contains(varName))
                {
                    continue;
                }
                var gv = pgp.symbolsLow.Globals.Lookup(varName);
                if (gv is GlobalUnaddressableArmadaVariable)
                {
                    caseBodies += $"case Armada_GlobalStaticVar_{varName} => H.Armada_GlobalStaticVar_{varName}\n";
                }
            }
            fn = $@"
        function ConvertGlobalStaticVar_LH(v: L.Armada_GlobalStaticVar) : H.Armada_GlobalStaticVar
          requires CanConvertGlobalStaticVar_LH(v)
        {{
          match v
            {caseBodies}
        }}
      ";
            pgp.AddFunction(fn, "convert");
        }
예제 #2
0
 public override string Extract()
 {
     return(AH.CombineStringsWithAnd(children.Select(child => child.Extract())));
 }