コード例 #1
0
 public override void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     //System.Reflection has no way to construct an actual function pointer.
     //What it returns when reflecting on a function pointer typeBuilder is System.IntPtr.
     //We'll do the same. Since function pointers are unverifiable, the typeBuilder mismatch at the call site does
     //not actually matter.
     this.result = typeof(System.IntPtr);
 }
コード例 #2
0
 public override void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     if (Process(functionPointerTypeReference))
     {
         visitor.Visit(functionPointerTypeReference);
     }
     base.Visit(functionPointerTypeReference);
 }
コード例 #3
0
ファイル: TypeInferencer.cs プロジェクト: xornand/cci
        public override void TraverseChildren(IPointerCall pointerCall)
        {
            IFunctionPointerTypeReference pointerType = (IFunctionPointerTypeReference)pointerCall.Pointer.Type;

            this.Traverse(pointerCall.Pointer);
            ((Expression)pointerCall.Pointer).Type = pointerType;
            this.Traverse(pointerCall.Arguments);
            ((PointerCall)pointerCall).Type = pointerType.Type;
        }
コード例 #4
0
    public override void TraverseChildren(IFunctionPointerTypeReference functionPointerTypeReference)
    {
        var typ = functionPointerTypeReference.ResolvedType;

        if (typ == Dummy.Type)
        {
            this.EmitError(functionPointerTypeReference, ErrorCode.FunctionPointerTypeResolution);
        }
        base.TraverseChildren(functionPointerTypeReference);
    }
コード例 #5
0
ファイル: MetadataVisitor.cs プロジェクト: CSRedRat/roslyn
 public virtual void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     this.Visit(functionPointerTypeReference.GetType(Context));
     this.Visit(functionPointerTypeReference.GetParameters(Context));
     this.Visit(functionPointerTypeReference.ExtraArgumentTypes);
     if (functionPointerTypeReference.ReturnValueIsModified)
     {
         this.Visit(functionPointerTypeReference.ReturnValueCustomModifiers);
     }
 }
コード例 #6
0
ファイル: MetadataVisitor.cs プロジェクト: belav/roslyn
        public virtual void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
        {
            this.Visit(functionPointerTypeReference.Signature.RefCustomModifiers);
            this.Visit(functionPointerTypeReference.Signature.ReturnValueCustomModifiers);
            this.Visit(functionPointerTypeReference.Signature.GetType(Context));

            foreach (var param in functionPointerTypeReference.Signature.GetParameters(Context))
            {
                this.Visit(param);
            }
        }
コード例 #7
0
 public override void Visit(IFunctionPointerTypeReference functionPointerTypeReference) {
   this.Visit((ISignature)functionPointerTypeReference);
   foreach (var extraArgument in functionPointerTypeReference.ExtraArgumentTypes) {
     Contract.Assume(extraArgument != null);
     this.Visit(extraArgument);
   }
 }
コード例 #8
0
ファイル: Visitors.cs プロジェクト: Refresh06/visualmutator
 public void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     throw new NotImplementedException();
 }
コード例 #9
0
 public override void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     if(Process(functionPointerTypeReference)){visitor.Visit(functionPointerTypeReference);}
     base.Visit(functionPointerTypeReference);
 }
コード例 #10
0
 public override void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     allElements.Add(new InvokInfo(Traverser, "IFunctionPointerTypeReference", functionPointerTypeReference));
 }
コード例 #11
0
        public override void TraverseChildren(IFunctionPointerTypeReference functionPointerTypeReference)
{ MethodEnter(functionPointerTypeReference);
            base.TraverseChildren(functionPointerTypeReference);
     MethodExit();   }
コード例 #12
0
ファイル: Visitors.cs プロジェクト: rasiths/visual-profiler
 /// <summary>
 /// Traverses the function pointer type reference.
 /// </summary>
 public void Traverse(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     Contract.Requires(functionPointerTypeReference != null);
       if (!this.objectsThatHaveAlreadyBeenTraversed.Add(functionPointerTypeReference)) return;
       if (this.preorderVisitor != null) this.preorderVisitor.Visit(functionPointerTypeReference);
       if (this.stopTraversal) return;
       this.TraverseChildren(functionPointerTypeReference);
       if (this.stopTraversal) return;
       if (this.postorderVisitor != null) this.postorderVisitor.Visit(functionPointerTypeReference);
 }
コード例 #13
0
ファイル: Visitors.cs プロジェクト: rasiths/visual-profiler
 /// <summary>
 /// Traverses the children of the function pointer type reference.
 /// </summary>
 public virtual void TraverseChildren(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     Contract.Requires(functionPointerTypeReference != null);
       this.TraverseChildren((ITypeReference)functionPointerTypeReference);
       this.Traverse(functionPointerTypeReference.Type);
       if (this.stopTraversal) return;
       this.Traverse(functionPointerTypeReference.Parameters);
       if (this.stopTraversal) return;
       this.Traverse(functionPointerTypeReference.ExtraArgumentTypes);
       if (this.stopTraversal) return;
       if (functionPointerTypeReference.ReturnValueIsModified)
     this.Traverse(functionPointerTypeReference.ReturnValueCustomModifiers);
 }
コード例 #14
0
        private static void InitializeArgumentsAndPushReturnResult(Instruction instruction, Stack <Instruction> stack, IFunctionPointerTypeReference funcPointer)
        {
            Contract.Requires(instruction != null);
            Contract.Requires(stack != null);
            Contract.Requires(funcPointer != null);

            instruction.Operand1 = stack.Pop(); //the function pointer
            var numArguments = IteratorHelper.EnumerableCount(funcPointer.Parameters);

            if (!funcPointer.IsStatic)
            {
                numArguments++;
            }
            var arguments = new Instruction[numArguments];

            instruction.Operand2 = arguments;
            for (var i = numArguments; i > 0; i--)
            {
                arguments[i - 1] = stack.Pop();
            }
            if (funcPointer.Type.TypeCode != PrimitiveTypeCode.Void)
            {
                stack.Push(instruction);
            }
        }
コード例 #15
0
ファイル: Visitors.cs プロジェクト: rasiths/visual-profiler
 /// <summary>
 /// Performs some computation with the given function pointer type reference.
 /// </summary>
 public virtual void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     this.Visit((ITypeReference)functionPointerTypeReference);
 }
コード例 #16
0
ファイル: MetadataVisitor.cs プロジェクト: pheede/roslyn
 public virtual void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     this.Visit(functionPointerTypeReference.GetType(Context));
     this.Visit(functionPointerTypeReference.GetParameters(Context));
     this.Visit(functionPointerTypeReference.ExtraArgumentTypes);
     if (functionPointerTypeReference.ReturnValueIsModified)
     {
         this.Visit(functionPointerTypeReference.ReturnValueCustomModifiers);
     }
 }
コード例 #17
0
 /// <summary>
 /// Performs some computation with the given function pointer type reference.
 /// </summary>
 public virtual void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
 {
 }
コード例 #18
0
 public IndirectMethodCallInstruction(uint label, IVariable result, IVariable pointer, IFunctionPointerTypeReference function, IEnumerable <IVariable> arguments)
     : base(label, result)
 {
     this.Arguments = new List <IVariable>(arguments);
     this.Pointer   = pointer;
     this.Function  = function;
 }
コード例 #19
0
 /// <summary>
 /// Rewrites the given function pointer type reference.
 /// </summary>
 public virtual IFunctionPointerTypeReference Rewrite(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     return functionPointerTypeReference;
 }
コード例 #20
0
        public override string GetTypeName(ITypeReference type, NameFormattingOptions formattingOptions)
        {
            Contract.Requires(type != null);
            Contract.Ensures(Contract.Result <string>() != null);

            if (type is Dummy)
            {
                return("Microsoft.Cci.DummyTypeReference");
            }
            if ((formattingOptions & NameFormattingOptions.UseTypeKeywords) != 0)
            {
                switch (type.TypeCode)
                {
                case PrimitiveTypeCode.Boolean: return("Boolean");

                case PrimitiveTypeCode.Char: return("Char");

                case PrimitiveTypeCode.Float32: return("Float");

                case PrimitiveTypeCode.Float64: return("Double");

                case PrimitiveTypeCode.Int16: return("Short");

                case PrimitiveTypeCode.Int32: return("Integer");

                case PrimitiveTypeCode.Int64: return("Long");

                case PrimitiveTypeCode.Int8: return("SByte");

                case PrimitiveTypeCode.String: return("String");

                case PrimitiveTypeCode.UInt16: return("UShort");

                case PrimitiveTypeCode.UInt32: return("UInteger");

                case PrimitiveTypeCode.UInt64: return("ULong");

                case PrimitiveTypeCode.UInt8: return("Byte");

                case PrimitiveTypeCode.Void: { Contract.Assert(false); throw new InvalidOperationException(); }

                case PrimitiveTypeCode.NotPrimitive:
                    if (TypeHelper.TypesAreEquivalent(type, type.PlatformType.SystemDecimal))
                    {
                        return("Decimal");
                    }
                    if (TypeHelper.TypesAreEquivalent(type, type.PlatformType.SystemObject))
                    {
                        return("Object");
                    }
                    break;
                }
            }
            IArrayTypeReference /*?*/ arrayType = type as IArrayTypeReference;

            if (arrayType != null)
            {
                return(this.GetArrayTypeName(arrayType, formattingOptions));
            }
            IFunctionPointerTypeReference /*?*/ functionPointerType = type as IFunctionPointerTypeReference;

            if (functionPointerType != null)
            {
                return(this.GetFunctionPointerTypeName(functionPointerType, formattingOptions));
            }
            IGenericTypeParameterReference /*?*/ genericTypeParam = type as IGenericTypeParameterReference;

            if (genericTypeParam != null)
            {
                return(this.GetGenericTypeParameterName(genericTypeParam, formattingOptions));
            }
            IGenericMethodParameterReference /*?*/ genericMethodParam = type as IGenericMethodParameterReference;

            if (genericMethodParam != null)
            {
                return(this.GetGenericMethodParameterName(genericMethodParam, formattingOptions));
            }
            IGenericTypeInstanceReference /*?*/ genericInstance = type as IGenericTypeInstanceReference;

            if (genericInstance != null)
            {
                return(this.GetGenericTypeInstanceName(genericInstance, formattingOptions));
            }
            INestedTypeReference /*?*/ ntTypeDef = type as INestedTypeReference;

            if (ntTypeDef != null)
            {
                return(this.GetNestedTypeName(ntTypeDef, formattingOptions));
            }
            INamespaceTypeReference /*?*/ nsTypeDef = type as INamespaceTypeReference;

            if (nsTypeDef != null)
            {
                return(this.GetNamespaceTypeName(nsTypeDef, formattingOptions));
            }
            IPointerTypeReference /*?*/ pointerType = type as IPointerTypeReference;

            if (pointerType != null)
            {
                return(this.GetPointerTypeName(pointerType, formattingOptions));
            }
            IManagedPointerTypeReference /*?*/ managedPointerType = type as IManagedPointerTypeReference;

            if (managedPointerType != null)
            {
                return(this.GetManagedPointerTypeName(managedPointerType, formattingOptions));
            }
            IModifiedTypeReference /*?*/ modifiedType = type as IModifiedTypeReference;

            if (modifiedType != null)
            {
                return(this.GetModifiedTypeName(modifiedType, formattingOptions));
            }
            if (type.ResolvedType != type && !(type.ResolvedType is Dummy))
            {
                return(this.GetTypeName(type.ResolvedType, formattingOptions));
            }
            return("unknown type: " + type.GetType().ToString());
        }
コード例 #21
0
ファイル: StatementSourceEmitter.cs プロジェクト: xornand/cci
 public override void TraverseChildren(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     base.TraverseChildren(functionPointerTypeReference);
 }
コード例 #22
0
 public virtual void onMetadataElement(IFunctionPointerTypeReference functionPointerTypeReference) { }
コード例 #23
0
ファイル: Visitors.cs プロジェクト: rasiths/visual-profiler
 /// <summary>
 /// Performs some computation with the given function pointer type reference.
 /// </summary>
 public virtual void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
 {
 }
コード例 #24
0
 public IndirectMethodCallExpression(IVariable pointer, IFunctionPointerTypeReference function, IEnumerable <IVariable> arguments)
 {
     this.Arguments = new List <IVariable>(arguments);
     this.Pointer   = pointer;
     this.Function  = function;
 }
コード例 #25
0
ファイル: Visitors.cs プロジェクト: rasiths/visual-profiler
 //^ ensures this.path.Count == old(this.path.Count);
 /// <summary>
 /// Performs some computation with the given function pointer type reference.
 /// </summary>
 /// <param name="functionPointerTypeReference"></param>
 public virtual void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     if (this.stopTraversal) return;
       //^ int oldCount = this.path.Count;
       this.path.Push(functionPointerTypeReference);
       this.Visit(functionPointerTypeReference.Type);
       this.Visit(functionPointerTypeReference.Parameters);
       this.Visit(functionPointerTypeReference.ExtraArgumentTypes);
       if (functionPointerTypeReference.ReturnValueIsModified)
     this.Visit(functionPointerTypeReference.ReturnValueCustomModifiers);
       //^ assume this.path.Count == oldCount+1; //True because all of the virtual methods of this class promise not decrease this.path.Count.
       this.path.Pop();
 }
コード例 #26
0
 public virtual void onMetadataElement(IFunctionPointerTypeReference functionPointerTypeReference)
 {
 }
コード例 #27
0
ファイル: Visitors.cs プロジェクト: rasiths/visual-profiler
 public void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     this.traverser.Traverse(functionPointerTypeReference);
 }
コード例 #28
0
ファイル: MetadataVisitor.cs プロジェクト: CSRedRat/roslyn
        /// <summary>
        /// Use this routine, rather than ITypeReference.Dispatch, to call the appropriate derived overload of an ITypeReference.
        /// The former routine will call Visit(INamespaceTypeDefinition) rather than Visit(INamespaceTypeReference), etc.,
        /// in the case where a definition is used as a reference to itself.
        /// </summary>
        /// <param name="typeReference">A reference to a type definition. Note that a type definition can serve as a reference to itself.</param>
        protected void DispatchAsReference(ITypeReference typeReference)
        {
            INamespaceTypeReference namespaceTypeReference = typeReference.AsNamespaceTypeReference;

            if (namespaceTypeReference != null)
            {
                this.Visit(namespaceTypeReference);
                return;
            }

            IGenericTypeInstanceReference genericTypeInstanceReference = typeReference.AsGenericTypeInstanceReference;

            if (genericTypeInstanceReference != null)
            {
                this.Visit(genericTypeInstanceReference);
                return;
            }

            INestedTypeReference nestedTypeReference = typeReference.AsNestedTypeReference;

            if (nestedTypeReference != null)
            {
                this.Visit(nestedTypeReference);
                return;
            }

            IArrayTypeReference arrayTypeReference = typeReference as IArrayTypeReference;

            if (arrayTypeReference != null)
            {
                this.Visit(arrayTypeReference);
                return;
            }

            IGenericTypeParameterReference genericTypeParameterReference = typeReference.AsGenericTypeParameterReference;

            if (genericTypeParameterReference != null)
            {
                this.Visit(genericTypeParameterReference);
                return;
            }

            IGenericMethodParameterReference genericMethodParameterReference = typeReference.AsGenericMethodParameterReference;

            if (genericMethodParameterReference != null)
            {
                this.Visit(genericMethodParameterReference);
                return;
            }

            IPointerTypeReference pointerTypeReference = typeReference as IPointerTypeReference;

            if (pointerTypeReference != null)
            {
                this.Visit(pointerTypeReference);
                return;
            }

            IFunctionPointerTypeReference functionPointerTypeReference = typeReference as IFunctionPointerTypeReference;

            if (functionPointerTypeReference != null)
            {
                this.Visit(functionPointerTypeReference);
                return;
            }

            IModifiedTypeReference modifiedTypeReference = typeReference as IModifiedTypeReference;

            if (modifiedTypeReference != null)
            {
                this.Visit(modifiedTypeReference);
                return;
            }
        }
コード例 #29
0
ファイル: Validator.cs プロジェクト: rasiths/visual-profiler
 /// <summary>
 /// Performs some computation with the given function pointer type reference.
 /// </summary>
 public void Visit(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     this.Visit((ITypeReference)functionPointerTypeReference);
     if (functionPointerTypeReference.Type is Dummy)
       this.ReportError(MetadataError.IncompleteNode, functionPointerTypeReference, "Type");
     if ((functionPointerTypeReference.CallingConvention & CallingConvention.ExplicitThis) != 0 && functionPointerTypeReference.IsStatic)
       this.ReportError(MetadataError.MethodsCalledWithExplicitThisParametersMustNotBeStatic, functionPointerTypeReference);
 }
コード例 #30
0
ファイル: StatementSourceEmitter.cs プロジェクト: xornand/cci
 public override void TraverseChildren(IFunctionPointerTypeReference functionPointerTypeReference) {
   base.TraverseChildren(functionPointerTypeReference);
 }
コード例 #31
0
 public override void TraverseChildren(IFunctionPointerTypeReference functionPointerTypeReference)
 {
     MethodEnter(functionPointerTypeReference);
     base.TraverseChildren(functionPointerTypeReference);
     MethodExit();
 }
コード例 #32
0
ファイル: Mapper.cs プロジェクト: Refresh06/visualmutator
 public override void Visit(IFunctionPointerTypeReference functionPointerTypeReference) {
   //System.Reflection has no way to construct an actual function pointer.
   //What it returns when reflecting on a function pointer typeBuilder is System.IntPtr.
   //We'll do the same. Since function pointers are unverifiable, the typeBuilder mismatch at the call site does
   //not actually matter.
   this.result = typeof(System.IntPtr);
 }