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 + ");"); }
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();"); } }
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() }); }
/// <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."); } }
public void Visit(TypeBool type) { WriteProperty(type); }
/// <summary> /// Boolean literal /// </summary> /// <param name="n"></param> public override void VisitBoolean(ASTBoolean n) { n.CFlatType = _lastSeenType = new TypeBool(); }
void Visitor.Visit(TypeBool type) { text = var.NamePrivate + (isEquals ? " == " : " != ") + another + "." + var.NamePrivate; }
void Visitor.Visit(TypeBool type) { Type = Zeze.Serialize.ByteBuffer.BOOL; }
void Visitor.Visit(TypeBool type) { }
void Visitor.Visit(TypeBool type) { SetDefaultValue("false"); }
public void Visit(TypeBool type) { Initial(); }
void Visitor.Visit(TypeBool type) { Name = "Zeze.ByteBuffer.BOOL"; }
public void Visit(TypeBool type) { text = variable.NamePrivate + ".CompareTo(" + another + "." + variable.NamePrivate + ")"; }
public void Visit(TypeBool type) { WriteLogValue(type); }
protected override OpTypeBool VisitTypeBool(TypeBool node) { return(Register(base.VisitTypeBool(node), _typeInstructions)); }
public override void VisitTypeBool(ASTTypeBool n) { n.Type = _lastSeenType = new TypeBool(); }
public void Visit(TypeBool type) { name = "boolean"; }
public void Visit(TypeBool type) { text = varname + ".GetHashCode()"; }
public void Visit(TypeBool type) { DefineStack(type); }
void Visitor.Visit(TypeBool type) { ChangeVariableCollectorName = "Zeze.Transaction.ChangeVariableCollectorChanged()"; }
void Visitor.Visit(TypeBool type) { sw.WriteLine(prefix + $"sb.Append(new string(' ', level * 4)).Append(\"{var}\").Append(\"=\").Append({var}).Append(\"{sep}\").Append(Environment.NewLine);"); }