Пример #1
0
 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;
       }         
     }         
   }
 }
Пример #2
0
        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);
 }
Пример #4
0
        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;
                    }
                }
            }
        }
Пример #5
0
 public virtual void onASTElement(ITokenOf tokenOf) { }
Пример #6
0
 /// <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);
 }
Пример #7
0
 public void Visit(ITokenOf tokenOf)
 {
     Contract.Requires(tokenOf != null);
       throw new NotImplementedException();
 }
Пример #8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tokenOf"></param>
 public TokenOf(ITokenOf tokenOf)
     : base(tokenOf)
 {
     this.definition = tokenOf.Definition;
 }
Пример #9
0
 /// <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);
 }
Пример #10
0
 public void Visit(ITokenOf tokenOf)
 {
     this.traverser.Traverse(tokenOf);
 }
Пример #11
0
 public virtual void onASTElement(ITokenOf tokenOf)
 {
 }
Пример #12
0
 //^ 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();
 }
Пример #13
0
 /// <summary>
 /// Returns a shallow copy of the given tokenof() expression.
 /// </summary>
 /// <param name="tokenOf"></param>
 public TokenOf Copy(ITokenOf tokenOf)
 {
     return new TokenOf(tokenOf);
 }
Пример #14
0
 /// <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;
 }
Пример #15
0
 /// <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++;
 }
Пример #16
0
 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);
 }
Пример #18
0
 public void Visit(ITokenOf tokenOf)
 {
     this.result = this.copier.Copy(tokenOf);
 }
Пример #19
0
 public override void Visit(ITokenOf tokenOf)
 {
     allElements.Add(new InvokInfo(Traverser, "ITokenOf", tokenOf));
 }
Пример #20
0
        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;
 }
Пример #22
0
 /// <summary>
 /// Performs some computation with the given tokenof() expression.
 /// </summary>
 /// <param name="tokenOf"></param>
 public virtual void Visit(ITokenOf tokenOf)
 {
 }
Пример #23
0
 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;
 }
Пример #24
0
 /// <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);
     }
       }
 }
Пример #25
0
    /// <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);
    }
Пример #26
0
 /// <summary>
 /// Performs some computation with the given tokenof() expression.
 /// </summary>
 /// <param name="tokenOf"></param>
 public virtual void Visit(ITokenOf tokenOf)
 {
     this.Visit((IExpression)tokenOf);
 }
 /// <summary>
 /// Performs some computation with the given tokenof() expression.
 /// </summary>
 /// <param name="tokenOf"></param>
 public virtual void Visit(ITokenOf tokenOf)
 {
 }
Пример #28
0
 public void Visit(ITokenOf tokenOf)
 {
     throw new NotImplementedException();
 }
Пример #29
0
 /// <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(")");
 }
Пример #31
0
 /// <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;
 }
Пример #32
0
 public override void TraverseChildren(ITokenOf tokenOf)
 {
     MethodEnter(tokenOf);
     base.TraverseChildren(tokenOf);
     MethodExit();
 }
Пример #33
0
 /// <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);
 }