示例#1
0
 public void Visit(TypeBool type)
 {
     if (id >= 0)
     {
         sw.WriteLine(prefix + bufname + ".WriteInt(Zeze.ByteBuffer.BOOL | " + id + " << Zeze.ByteBuffer.TAG_SHIFT);");
     }
     sw.WriteLine(prefix + bufname + ".WriteBool(" + varname + ");");
 }
示例#2
0
 void Visitor.Visit(TypeBool type)
 {
     if (id >= 0)
     {
         sw.WriteLine(prefix + "case (Zeze.ByteBuffer.BOOL | " + id + " << Zeze.ByteBuffer.TAG_SHIFT): ");
         sw.WriteLine(prefix + "    " + varname + " = " + bufname + ".ReadBool();");
         sw.WriteLine(prefix + "    break;");
     }
     else
     {
         sw.WriteLine(prefix + varname + " = " + bufname + ".ReadBool();");
     }
 }
示例#3
0
 public static IType TypeMap(Func <int, TypeVar, IType> onVar, int c, IType t)
 {
     IType Walk(int c, IType t)
     {
         return(t switch
         {
             TypeVar v => onVar(c, v),
             TypeId i => i,
             TypeString ts => ts,
             TypeUnit u => u,
             TypeRecord r => new TypeRecord(r.Variants.Select(p => (p.Item1, Walk(c, p.Item2)))),
             TypeFloat f => f,
             TypeBool b => b,
             TypeNat n => n,
             TypeArrow a => new TypeArrow(Walk(c, a.From), Walk(c, a.To)),
             TypeVariant tv => new TypeVariant(tv.Variants.Select(p => (p.Item1, Walk(c, p.Item2)))),
             _ => throw new InvalidOperationException()
         });
     }
示例#4
0
文件: ThirdPass.cs 项目: goric/cflat
        /// <summary>
        ///
        /// </summary>
        /// <param name="n"></param>
        public override void VisitFor(ASTFor n)
        {
            //define the block scope now to incapsulate the declared variable.
            BeginForLoopBlock();

            CFlatType initType = CheckSubTree(n.InitialExpr);

            n.InitialExpr.CFlatType = initType;

            TypeBool condition = CheckSubTree(n.Conditional) as TypeBool;

            if (condition != null)
            {
                n.Conditional.CFlatType = condition;
                CFlatType loopType = CheckSubTree(n.LoopExpr);
                n.LoopExpr.CFlatType = loopType;

                CheckSubTree(n.Body);
            }
            else
            {
                ReportError(n.Location, "The condition of a for loop must be a boolean.");
            }
        }
示例#5
0
 public void Visit(TypeBool type)
 {
     WriteProperty(type);
 }
示例#6
0
文件: ThirdPass.cs 项目: goric/cflat
 /// <summary>
 /// Boolean literal
 /// </summary>
 /// <param name="n"></param>
 public override void VisitBoolean(ASTBoolean n)
 {
     n.CFlatType = _lastSeenType = new TypeBool();
 }
示例#7
0
 void Visitor.Visit(TypeBool type)
 {
     text = var.NamePrivate + (isEquals ? " == " : " != ") + another + "." + var.NamePrivate;
 }
示例#8
0
 void Visitor.Visit(TypeBool type)
 {
     Type = Zeze.Serialize.ByteBuffer.BOOL;
 }
示例#9
0
 void Visitor.Visit(TypeBool type)
 {
 }
示例#10
0
文件: Default.cs 项目: e2wugui/zeze
 void Visitor.Visit(TypeBool type)
 {
     SetDefaultValue("false");
 }
示例#11
0
文件: Construct.cs 项目: e2wugui/zeze
 public void Visit(TypeBool type)
 {
     Initial();
 }
示例#12
0
 void Visitor.Visit(TypeBool type)
 {
     Name = "Zeze.ByteBuffer.BOOL";
 }
示例#13
0
文件: Compare.cs 项目: e2wugui/zeze
 public void Visit(TypeBool type)
 {
     text = variable.NamePrivate + ".CompareTo(" + another + "." + variable.NamePrivate + ")";
 }
示例#14
0
 public void Visit(TypeBool type)
 {
     WriteLogValue(type);
 }
示例#15
0
 protected override OpTypeBool VisitTypeBool(TypeBool node)
 {
     return(Register(base.VisitTypeBool(node), _typeInstructions));
 }
示例#16
0
文件: SecondPass.cs 项目: goric/cflat
 public override void VisitTypeBool(ASTTypeBool n)
 {
     n.Type = _lastSeenType = new TypeBool();
 }
示例#17
0
 public void Visit(TypeBool type)
 {
     name = "boolean";
 }
示例#18
0
 public void Visit(TypeBool type)
 {
     text = varname + ".GetHashCode()";
 }
示例#19
0
文件: Define.cs 项目: e2wugui/zeze
 public void Visit(TypeBool type)
 {
     DefineStack(type);
 }
示例#20
0
 void Visitor.Visit(TypeBool type)
 {
     ChangeVariableCollectorName = "Zeze.Transaction.ChangeVariableCollectorChanged()";
 }
示例#21
0
文件: Tostring.cs 项目: e2wugui/zeze
 void Visitor.Visit(TypeBool type)
 {
     sw.WriteLine(prefix + $"sb.Append(new string(' ', level * 4)).Append(\"{var}\").Append(\"=\").Append({var}).Append(\"{sep}\").Append(Environment.NewLine);");
 }