public IType makeTypeI(Type boogieType, Context context) { Debug.Assert(boogieType != null); IType result; var ts = boogieType as TypeSynonymAnnotation; TypeConstructorInstance originalType; if (ts == null) { originalType = null; } else { TypeConstructor originalConstructor = makeConstructor(ts.Decl.Name, ts.Decl.TypeParameters.Count); originalType = new TypeConstructorInstance(originalConstructor, makeTypes(ts.Arguments, context)); } // string originalName = (ts!=null)?ts.ToString():null; if (boogieType.IsBool) { result = BooleanType.booleanType; } else if (boogieType.IsInt) { result = IntegerType.integerType; } else if (boogieType.IsBv) { result = BitVectorType.makeBitVectorType((boogieType as BvType).BvBits); } else if (boogieType.IsCtor) { TypeConstructor constructor = makeConstructor(boogieType.AsCtor.Decl.Name, boogieType.AsCtor.Decl.Arity); result = new TypeConstructorInstance(constructor, makeTypes(boogieType.AsCtor.Arguments, context)); } else if (boogieType.IsMap) { Microsoft.Boogie.MapType bmt = boogieType.AsMap; pushTypeVariables(ref context, bmt.TypeParameters); result = new MapType( makeTypeVariables(context, bmt.TypeParameters), makeTypes(bmt.Arguments, context), makeTypeI(bmt.Result, context), originalType); context.pop(); } else if (boogieType.IsVariable) { result = new VariableType(context.lookupTypeVariable(boogieType.AsVariable.Name)); } else { throw new Exception("Unsupported Boogie type:" + boogieType); } result.check(context); return(result); }
public virtual void visit(TypeConstructorInstance t) { visitTypeConstructor(t.typeConstructor); foreach (var d in t.arguments) { d.visit(this); } }
public void visit(TypeConstructorInstance t) { if (t.freeTypeVariables.Except(tpSet).Count() > 0) { tqStack.Peek().addType(t); } /* foreach (var tt in t.arguments) * tt.visit(this);*/ }
////////////////////////////////////////////////////////////////////////// private static string toBoogie(TypeConstructorInstance tci) { string result = tci.typeConstructor.name; foreach (var a in tci.arguments) { result += " " + "(" + toBoogie(a) + ")"; } return(result); }
internal void addType(TypeConstructorInstance t) { CITypes[t.ToString()] = t; }
public override void visit(TypeConstructorInstance t) { base.visit(t); unusedTypeConstructors.Remove(t.typeConstructor.name); unusedTypeSynonyms.Remove(t.typeConstructor.name); }