public override void TraverseChildren(ITokenOf tokenOf) { base.TraverseChildren(tokenOf); var typeRef = tokenOf.Definition as ITypeReference; if (typeRef == null) { var typeMemberRef = tokenOf.Definition as ITypeMemberReference; if (typeMemberRef != null) typeRef = typeMemberRef.ContainingType; } if (typeRef != null) { var typeDef = typeRef.ResolvedType; if (TypeHelper.IsCompilerGenerated(typeDef)) { if (this.closuresThatCannotBeDeleted == null) this.closuresThatCannotBeDeleted = new Hashtable<object>(); while (typeDef != null) { this.closuresThatCannotBeDeleted[typeDef.InternedKey] = typeDef; ITypeDefinition baseType = null; foreach (var baseTypeRef in typeDef.BaseClasses) { baseType = baseTypeRef as ITypeDefinition; if (baseType != null) break; } typeDef = baseType; } } } }
public override void TraverseChildren(ITokenOf tokenOf) { base.TraverseChildren(tokenOf); ITypeReference type; IFieldReference /*?*/ field = tokenOf.Definition as IFieldReference; if (field != null) { type = this.platformType.SystemRuntimeFieldHandle; } else { IMethodReference /*?*/ method = tokenOf.Definition as IMethodReference; if (method != null) { type = this.platformType.SystemRuntimeMethodHandle; } else { Contract.Assume(tokenOf.Definition is ITypeReference); type = this.platformType.SystemRuntimeTypeHandle; } } ((TokenOf)tokenOf).Type = type; }
public override void Visit(ITokenOf tokenOf) { if (Process(tokenOf)) { visitor.Visit(tokenOf); } base.Visit(tokenOf); }
public override void TraverseChildren(ITokenOf tokenOf) { base.TraverseChildren(tokenOf); var typeRef = tokenOf.Definition as ITypeReference; if (typeRef == null) { var typeMemberRef = tokenOf.Definition as ITypeMemberReference; if (typeMemberRef != null) { typeRef = typeMemberRef.ContainingType; } } if (typeRef != null) { var typeDef = typeRef.ResolvedType; if (TypeHelper.IsCompilerGenerated(typeDef)) { if (this.closuresThatCannotBeDeleted == null) { this.closuresThatCannotBeDeleted = new Hashtable <object>(); } while (typeDef != null) { this.closuresThatCannotBeDeleted[typeDef.InternedKey] = typeDef; ITypeDefinition baseType = null; foreach (var baseTypeRef in typeDef.BaseClasses) { baseType = baseTypeRef as ITypeDefinition; if (baseType != null) { break; } } typeDef = baseType; } } } }
public virtual void onASTElement(ITokenOf tokenOf) { }
/// <summary> /// Visits the specified token of. /// </summary> /// <param name="tokenOf">The token of.</param> public override void Visit(ITokenOf tokenOf) { TokenOf mutableTokenOf = tokenOf as TokenOf; if (alwaysMakeACopy || mutableTokenOf == null) mutableTokenOf = new TokenOf(tokenOf); this.resultExpression = this.myCodeMutator.Visit(mutableTokenOf); }
public void Visit(ITokenOf tokenOf) { Contract.Requires(tokenOf != null); throw new NotImplementedException(); }
/// <summary> /// /// </summary> /// <param name="tokenOf"></param> public TokenOf(ITokenOf tokenOf) : base(tokenOf) { this.definition = tokenOf.Definition; }
/// <summary> /// Traverses the tokenof() expression. /// </summary> public void Traverse(ITokenOf tokenOf) { Contract.Requires(tokenOf != null); if (this.preorderVisitor != null) this.preorderVisitor.Visit(tokenOf); if (this.StopTraversal) return; this.TraverseChildren(tokenOf); if (this.StopTraversal) return; if (this.postorderVisitor != null) this.postorderVisitor.Visit(tokenOf); }
public void Visit(ITokenOf tokenOf) { this.traverser.Traverse(tokenOf); }
//^ ensures this.path.Count == old(this.path.Count); /// <summary> /// Traverses the given tokenof() expression. /// </summary> /// <param name="tokenOf"></param> public virtual void Visit(ITokenOf tokenOf) { if (this.stopTraversal) return; //^ int oldCount = this.path.Count; this.path.Push(tokenOf); IFieldReference/*?*/ fieldReference = tokenOf.Definition as IFieldReference; if (fieldReference != null) this.Visit(fieldReference); else { IMethodReference/*?*/ methodReference = tokenOf.Definition as IMethodReference; if (methodReference != null) this.Visit(methodReference); else this.Visit((ITypeReference)tokenOf.Definition); } //^ 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> /// Returns a shallow copy of the given tokenof() expression. /// </summary> /// <param name="tokenOf"></param> public TokenOf Copy(ITokenOf tokenOf) { return new TokenOf(tokenOf); }
/// <summary> /// Rewrites the given tokenof() expression. /// </summary> /// <param name="tokenOf"></param> public virtual IExpression Rewrite(ITokenOf tokenOf) { var mutableTokenOf = tokenOf as TokenOf; if (mutableTokenOf == null) return tokenOf; this.RewriteChildren(mutableTokenOf); return mutableTokenOf; }
/// <summary> /// Generates IL for the specified token of. /// </summary> /// <param name="tokenOf">The token of.</param> public override void TraverseChildren(ITokenOf tokenOf) { IFieldReference/*?*/ fieldReference = tokenOf.Definition as IFieldReference; if (fieldReference != null) this.generator.Emit(OperationCode.Ldtoken, fieldReference); else { IMethodReference/*?*/ methodReference = tokenOf.Definition as IMethodReference; if (methodReference != null) this.generator.Emit(OperationCode.Ldtoken, methodReference); else this.generator.Emit(OperationCode.Ldtoken, (ITypeReference)tokenOf.Definition); } this.StackSize++; }
public void Visit(ITokenOf tokenOf) { this.result = this.rewriter.Rewrite(tokenOf); }
public override void Visit(ITokenOf tokenOf) { if(Process(tokenOf)){visitor.Visit(tokenOf);} base.Visit(tokenOf); }
public void Visit(ITokenOf tokenOf) { this.result = this.copier.Copy(tokenOf); }
public override void Visit(ITokenOf tokenOf) { allElements.Add(new InvokInfo(Traverser, "ITokenOf", tokenOf)); }
public override void TraverseChildren(ITokenOf tokenOf) { MethodEnter(tokenOf); base.TraverseChildren(tokenOf); MethodExit(); }
/// <summary> /// Rewrites the given tokenof(); expression. /// </summary> /// <param name="tokenOf"></param> public virtual IExpression Rewrite(ITokenOf tokenOf) { return tokenOf; }
/// <summary> /// Performs some computation with the given tokenof() expression. /// </summary> /// <param name="tokenOf"></param> public virtual void Visit(ITokenOf tokenOf) { }
public override void TraverseChildren(ITokenOf tokenOf) { base.TraverseChildren(tokenOf); ITypeReference type; IFieldReference/*?*/ field = tokenOf.Definition as IFieldReference; if (field != null) type = this.platformType.SystemRuntimeFieldHandle; else { IMethodReference/*?*/ method = tokenOf.Definition as IMethodReference; if (method != null) type = this.platformType.SystemRuntimeMethodHandle; else { Contract.Assume(tokenOf.Definition is ITypeReference); type = this.platformType.SystemRuntimeTypeHandle; } } ((TokenOf)tokenOf).Type = type; }
/// <summary> /// Traverses the children of the tokenof() expression. /// </summary> public virtual void TraverseChildren(ITokenOf tokenOf) { Contract.Requires(tokenOf != null); this.TraverseChildren((IExpression)tokenOf); if (this.StopTraversal) return; var fieldReference = tokenOf.Definition as IFieldReference; if (fieldReference != null) this.Traverse(fieldReference); else { var methodReference = tokenOf.Definition as IMethodReference; if (methodReference != null) this.Traverse(methodReference); else { var typeReference = (ITypeReference)tokenOf.Definition; this.Traverse(typeReference); } } }
/// <summary> /// Returns a shallow copy of the given tokenof() expression. /// </summary> /// <param name="tokenOf"></param> public TokenOf Copy(ITokenOf tokenOf) { Contract.Requires(tokenOf != null); Contract.Ensures(Contract.Result<TokenOf>() != null); return new TokenOf(tokenOf); }
/// <summary> /// Performs some computation with the given tokenof() expression. /// </summary> /// <param name="tokenOf"></param> public virtual void Visit(ITokenOf tokenOf) { this.Visit((IExpression)tokenOf); }
public void Visit(ITokenOf tokenOf) { throw new NotImplementedException(); }
/// <summary> /// Visits the specified token of. /// </summary> /// <param name="tokenOf">The token of.</param> public override void Visit(ITokenOf tokenOf) { TokenOf mutableTokenOf = new TokenOf(tokenOf); this.resultExpression = this.myCodeCopier.DeepCopy(mutableTokenOf); }
public override void TraverseChildren(ITokenOf tokenOf) { this.sourceEmitterOutput.Write("tokenof("); base.TraverseChildren(tokenOf); this.sourceEmitterOutput.Write(")"); }
/// <summary> /// Returns a deep copy of the given tokenof() expression. /// </summary> /// <param name="tokenOf"></param> public TokenOf Copy(ITokenOf tokenOf) { var mutableCopy = this.shallowCopier.Copy(tokenOf); this.CopyChildren((Expression)mutableCopy); var fieldReference = mutableCopy.Definition as IFieldReference; if (fieldReference != null) mutableCopy.Definition = this.Copy(fieldReference); else { var methodReference = mutableCopy.Definition as IMethodReference; if (methodReference != null) mutableCopy.Definition = this.Copy(methodReference); else { var typeReference = (ITypeReference)mutableCopy.Definition; mutableCopy.Definition = this.Copy(typeReference); } } return mutableCopy; }
/// <summary> /// Visits the specified token of. /// </summary> /// <param name="tokenOf">The token of.</param> public override void Visit(ITokenOf tokenOf) { TokenOf mutableTokenOf = tokenOf as TokenOf; if (mutableTokenOf == null) { this.resultExpression = tokenOf; return; } this.resultExpression = this.myCodeMutator.Visit(mutableTokenOf); }