public override void Visit(ITypeOf typeOf) { if (Process(typeOf)) { visitor.Visit(typeOf); } base.Visit(typeOf); }
private static string GetExceptionId(IPrecondition precondition) { Contract.Requires(precondition != null); if (precondition.ExceptionToThrow != null) { ITypeOf asTypeOf = precondition.ExceptionToThrow as ITypeOf; ITypeReference unspecializedExceptionType; if (asTypeOf != null) { unspecializedExceptionType = MethodHelper.Unspecialize(asTypeOf.TypeToGet); } else//Legacy contracts package exceptions differently then regular contracts. { unspecializedExceptionType = MethodHelper.Unspecialize(precondition.ExceptionToThrow.Type); } return(TypeHelper.GetTypeName(unspecializedExceptionType, NameFormattingOptions.DocumentationId)); } return(null); }
public void Visit(ITypeOf typeOf) { throw new NotImplementedException(); }
/// <summary> /// Generates IL for the specified type of. /// </summary> /// <param name="typeOf">The type of.</param> public override void TraverseChildren(ITypeOf typeOf) { this.generator.Emit(OperationCode.Ldtoken, typeOf.TypeToGet); this.generator.Emit(OperationCode.Call, this.GetTypeFromHandle); this.StackSize++; }
/// <summary> /// Traverses the children of the typeof() expression. /// </summary> public virtual void TraverseChildren(ITypeOf typeOf) { Contract.Requires(typeOf != null); this.TraverseChildren((IExpression)typeOf); if (this.StopTraversal) return; this.Traverse(typeOf.TypeToGet); }
/// <summary> /// Performs some computation with the given typeof() expression. /// </summary> /// <param name="typeOf"></param> public virtual void Visit(ITypeOf typeOf) { this.Visit((IExpression)typeOf); }
public override void TraverseChildren(ITypeOf typeOf) { MethodEnter(typeOf); base.TraverseChildren(typeOf); MethodExit(); }
/// <summary> /// Performs some computation with the given typeof() expression. /// </summary> /// <param name="typeOf"></param> public virtual void Visit(ITypeOf typeOf) { }
/// <summary> /// Returns a shallow copy of the given typeof() expression. /// </summary> /// <param name="typeOf"></param> public TypeOf Copy(ITypeOf typeOf) { return new TypeOf(typeOf); }
public override void TraverseChildren(ITypeOf typeOf) { var e = this.sink.FindOrCreateTypeReferenceInCodeContext(typeOf.TypeToGet); TranslatedExpressions.Push(e); }
public override void Visit(ITypeOf typeOf) { if(Process(typeOf)){visitor.Visit(typeOf);} base.Visit(typeOf); }
public virtual void onASTElement(ITypeOf typeOf) { }
private HLLocation ProcessTypeOfExpression(ITypeOf pExpression) { return(HLTypeOfLocation.Create(HLDomain.GetOrCreateType(pExpression.TypeToGet))); }
private HLLocation ProcessTypeOfExpression(ITypeOf pExpression) { return HLTypeOfLocation.Create(HLDomain.GetOrCreateType(pExpression.TypeToGet)); }
public void Visit(ITypeOf typeOf) { this.result = this.rewriter.Rewrite(typeOf); }
/// <summary> /// Rewrites the given typeof() expression. /// </summary> /// <param name="typeOf"></param> public virtual IExpression Rewrite(ITypeOf typeOf) { var mutableTypeOf = typeOf as TypeOf; if (mutableTypeOf == null) return typeOf; this.RewriteChildren(mutableTypeOf); return mutableTypeOf; }
/// <summary> /// Visits the specified type of. /// </summary> /// <param name="typeOf">The type of.</param> public override void Visit(ITypeOf typeOf) { TypeOf mutableTypeOf = typeOf as TypeOf; if (alwaysMakeACopy || mutableTypeOf == null) mutableTypeOf = new TypeOf(typeOf); this.resultExpression = this.myCodeMutator.Visit(mutableTypeOf); }
/// <summary> /// Visits the specified type of. /// </summary> /// <param name="typeOf">The type of.</param> public override void Visit(ITypeOf typeOf) { TypeOf mutableTypeOf = typeOf as TypeOf; if (mutableTypeOf == null) { this.resultExpression = typeOf; return; } this.resultExpression = this.myCodeMutator.Visit(mutableTypeOf); }
public override void TraverseChildren(ITypeOf typeOf) { base.TraverseChildren(typeOf); ((TypeOf)typeOf).Type = this.platformType.SystemType; }
public void Visit(ITypeOf typeOf) { this.result = this.copier.Copy(typeOf); }
public override void Visit(ITypeOf typeOf) { allElements.Add(new InvokInfo(Traverser, "ITypeOf", typeOf)); }
/// <summary> /// Rewrites the given typeof(); expression. /// </summary> /// <param name="typeOf"></param> public virtual IExpression Rewrite(ITypeOf typeOf) { return typeOf; }
//^ ensures this.path.Count == old(this.path.Count); /// <summary> /// Traverses the given typeof() expression. /// </summary> /// <param name="typeOf"></param> public virtual void Visit(ITypeOf typeOf) { if (this.stopTraversal) return; //^ int oldCount = this.path.Count; this.path.Push(typeOf); this.Visit(typeOf.TypeToGet); //^ assume this.path.Count == oldCount+1; //True because all of the virtual methods of this class promise not to decrease this.path.Count. this.path.Pop(); }
/// <summary> /// Traverses the typeof() expression. /// </summary> public void Traverse(ITypeOf typeOf) { Contract.Requires(typeOf != null); if (this.preorderVisitor != null) this.preorderVisitor.Visit(typeOf); if (this.StopTraversal) return; this.TraverseChildren(typeOf); if (this.StopTraversal) return; if (this.postorderVisitor != null) this.postorderVisitor.Visit(typeOf); }
/// <summary> /// Returns a shallow copy of the given typeof() expression. /// </summary> /// <param name="typeOf"></param> public TypeOf Copy(ITypeOf typeOf) { Contract.Requires(typeOf != null); Contract.Ensures(Contract.Result<TypeOf>() != null); return new TypeOf(typeOf); }
public void Visit(ITypeOf typeOf) { this.traverser.Traverse(typeOf); }
/// <summary> /// Returns a deep copy of the given typeof() expression. /// </summary> /// <param name="typeOf"></param> public TypeOf Copy(ITypeOf typeOf) { Contract.Requires(typeOf != null); Contract.Ensures(Contract.Result<TypeOf>() != null); var mutableCopy = this.shallowCopier.Copy(typeOf); this.CopyChildren((Expression)mutableCopy); mutableCopy.TypeToGet = this.Copy(mutableCopy.TypeToGet); return mutableCopy; }
public void Visit(ITypeOf typeOf) { Contract.Requires(typeOf != null); throw new NotImplementedException(); }
/// <summary> /// /// </summary> /// <param name="typeOf"></param> public TypeOf(ITypeOf typeOf) : base(typeOf) { this.typeToGet = typeOf.TypeToGet; }
/// <summary> /// Visits the specified type of. /// </summary> /// <param name="typeOf">The type of.</param> public override void Visit(ITypeOf typeOf) { TypeOf mutableTypeOf = new TypeOf(typeOf); this.resultExpression = this.myCodeCopier.DeepCopy(mutableTypeOf); }
public override void TraverseChildren(ITypeOf typeOf) { this.sourceEmitterOutput.Write("typeof("); this.PrintTypeReference(typeOf.TypeToGet); this.sourceEmitterOutput.Write(")"); }
/// <summary> /// Returns a deep copy of the given typeof() expression. /// </summary> /// <param name="typeOf"></param> public TypeOf Copy(ITypeOf typeOf) { var mutableCopy = this.shallowCopier.Copy(typeOf); this.CopyChildren((Expression)mutableCopy); mutableCopy.TypeToGet = this.Copy(mutableCopy.TypeToGet); return mutableCopy; }
/// <summary> /// Listen to all the IMethodDefinitions /// </summary> /// <param name="methodDefinition"></param> public override void Visit(IMethodDefinition methodDefinition) { if (methodDefinition == null) { return; } if (IsGetter(methodDefinition) || IsSetter(methodDefinition)) { return; } string methodName = MemberHelper.GetMethodSignature(methodDefinition, NameFormattingOptions.DocID); Console.WriteLine(methodName); IMethodContract methodContract = this.contractProvider.GetMethodContractFor(methodDefinition); //IMethodContract inheritedContract = ContractHelper.InheritMethodContracts(this.host, this.contractProvider, methodDefinition); if (methodContract != null) { XElement member = GetMemberElement(membersElement, methodDefinition); //Add contract exceptions WriteExceptions(member, methodContract); //Add a new element for each contract if (options.toSummary == false) { foreach (IPrecondition contractElement in methodContract.Preconditions) { Contract.Assume(contractElement != null, "lack of contracts for collections"); XAttribute exceptionAttribute = null; if (contractElement.ExceptionToThrow != null) { ITypeOf asTypeOf = contractElement.ExceptionToThrow as ITypeOf; if (asTypeOf != null) { exceptionAttribute = GetTypeAttribute("exception", asTypeOf.TypeToGet); } } WriteContractElement(member, contractElement, "requires", GetDescriptionAttribute(contractElement), exceptionAttribute); } foreach (IPostcondition contractElement in methodContract.Postconditions) { Contract.Assume(contractElement != null, "lack of contracts for collections"); WriteContractElement(member, contractElement, "ensures", GetDescriptionAttribute(contractElement)); } foreach (IThrownException thrownException in methodContract.ThrownExceptions) { Contract.Assume(thrownException != null, "lack of contracts for collections"); Contract.Assume(thrownException.Postcondition != null, "lack of CCI2 contracts"); WriteContractElement(member, thrownException.Postcondition, "ensuresOnThrow", GetDescriptionAttribute(thrownException.Postcondition), GetTypeAttribute("exception", thrownException.ExceptionType)); } } //Add contract information into the summary element else { XElement summaryElement = GetSummaryElement(member); summaryElement.Add(new XElement("para", "Requires: ")); foreach (IContractElement contractElement in methodContract.Preconditions) { Contract.Assume(contractElement != null, "lack of contracts for collections"); WriteContractElementToSummary(summaryElement, contractElement); } summaryElement.Add(new XElement("para", "Ensures: ")); foreach (IContractElement contractElement in methodContract.Postconditions) { Contract.Assume(contractElement != null, "lack of contracts for collections"); WriteContractElementToSummary(summaryElement, contractElement); } summaryElement.Add(new XElement("para", "EnsuresOnThrow: ")); foreach (ThrownException thrownException in methodContract.ThrownExceptions) { Contract.Assume(thrownException != null, "lack of contracts for collections"); Contract.Assume(thrownException.Postcondition != null, "lack of contracts for CCI2"); Contract.Assume(thrownException.ExceptionType != null, "lack of contracts for CCI2"); WriteContractElementToSummary(summaryElement, thrownException.Postcondition, thrownException.ExceptionType.ToString()); } WriteContractElementsToReleventParameters(member, methodDefinition, methodContract); } } base.Visit(methodDefinition); }