当前位置: 首页>>代码示例>>C#>>正文


C# IMetadataHost类代码示例

本文整理汇总了C#中IMetadataHost的典型用法代码示例。如果您正苦于以下问题:C# IMetadataHost类的具体用法?C# IMetadataHost怎么用?C# IMetadataHost使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IMetadataHost类属于命名空间,在下文中一共展示了IMetadataHost类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TypeInferencer

 internal TypeInferencer(INamedTypeReference containingType, IMetadataHost host) {
   Contract.Requires(containingType != null);
   Contract.Requires(host != null);
   this.containingType = containingType;
   this.host = host;
   this.platformType = containingType.PlatformType;
 }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:7,代码来源:TypeInferencer.cs

示例2: FieldAssignmentReplacementBuilder

 public FieldAssignmentReplacementBuilder(FieldReference field, IMetadataHost host, ExpressionStatement assignment, ReplacementRegistry registry)
 {
     this.field = field;
     this.host = host;
     this.assignment = assignment;
     this.registry = registry;
 }
开发者ID:jamarchist,项目名称:SharpMock,代码行数:7,代码来源:FieldAssignmentReplacementBuilder.cs

示例3: FindClosureMoveNext

 /// <summary>
 /// For an iterator method, find the closure class' MoveNext method and return its body.
 /// </summary>
 /// <param name="host"></param>
 /// <param name="possibleIterator">The (potential) iterator method.</param>
 /// <returns>Dummy.MethodBody if <paramref name="possibleIterator"/> does not fit into the code pattern of an iterator method, 
 /// or the body of the MoveNext method of the corresponding closure class if it does.
 /// </returns>
 public static IMethodBody/*?*/ FindClosureMoveNext(IMetadataHost host, ISourceMethodBody/*!*/ possibleIterator) {
   if (possibleIterator is Dummy) return null;
   var nameTable = host.NameTable;
   var possibleIteratorBody = possibleIterator.Block;
   foreach (var statement in possibleIteratorBody.Statements) {
     var expressionStatement = statement as IExpressionStatement;
     if (expressionStatement != null)
       return FirstStatementIsIteratorCreation(host, possibleIterator, nameTable, statement);
     break;
   }
   foreach (var statement in possibleIteratorBody.Statements){
     //var lds = statement as ILocalDeclarationStatement;
     //if (lds != null) {
     //  if (lds.InitialValue != null)
     //    return null;
     //  else
     //    continue;
     //}
     var returnStatement = statement as IReturnStatement;
     if (returnStatement == null) return null;
     var blockExpression = returnStatement.Expression as IBlockExpression;
     if (blockExpression == null) return null;
     foreach (var s in blockExpression.BlockStatement.Statements) {
       return FirstStatementIsIteratorCreation(host, possibleIterator, nameTable, s);
     }
   }
   return null;
 }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:36,代码来源:MoveNext.cs

示例4: AnonymousDelegateCachingRemover

 internal AnonymousDelegateCachingRemover(IMetadataHost host, Hashtable<IAnonymousDelegate>/*?*/ delegatesCachedInFields,
   Hashtable<LocalDefinition, AnonymousDelegate>/*?*/ delegatesCachedInLocals)
   : base(host) {
   Contract.Requires(host != null);
   this.delegatesCachedInFields = delegatesCachedInFields;
   this.delegatesCachedInLocals = delegatesCachedInLocals;
 }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:7,代码来源:AnonymousDelegateCachingRemover.cs

示例5: FirstStatementIsIteratorCreation

 private static IMethodBody/*?*/ FirstStatementIsIteratorCreation(IMetadataHost host, ISourceMethodBody possibleIterator, INameTable nameTable, IStatement statement) {
   ICreateObjectInstance createObjectInstance = GetICreateObjectInstance(statement);
   if (createObjectInstance == null) {
     // If the first statement in the method body is not the creation of iterator closure, return a dummy.
     // Possible corner case not handled: a local is used to hold the constant value for the initial state of the closure.
     return null;
   }
   ITypeReference closureType/*?*/ = createObjectInstance.MethodToCall.ContainingType;
   ITypeReference unspecializedClosureType = ContractHelper.Unspecialized(closureType);
   if (!AttributeHelper.Contains(unspecializedClosureType.Attributes, host.PlatformType.SystemRuntimeCompilerServicesCompilerGeneratedAttribute))
     return null;
   INestedTypeReference closureTypeAsNestedTypeReference = unspecializedClosureType as INestedTypeReference;
   if (closureTypeAsNestedTypeReference == null) return null;
   ITypeReference unspecializedClosureContainingType = ContractHelper.Unspecialized(closureTypeAsNestedTypeReference.ContainingType);
   if (closureType != null && TypeHelper.TypesAreEquivalent(possibleIterator.MethodDefinition.ContainingTypeDefinition, unspecializedClosureContainingType)) {
     IName MoveNextName = nameTable.GetNameFor("MoveNext");
     foreach (ITypeDefinitionMember member in closureType.ResolvedType.GetMembersNamed(MoveNextName, false)) {
       IMethodDefinition moveNext = member as IMethodDefinition;
       if (moveNext != null) {
         ISpecializedMethodDefinition moveNextGeneric = moveNext as ISpecializedMethodDefinition;
         if (moveNextGeneric != null)
           moveNext = moveNextGeneric.UnspecializedVersion.ResolvedMethod;
         return moveNext.Body;
       }
     }
   }
   return null;
 }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:28,代码来源:MoveNext.cs

示例6: CalculateCyclomaticComplexity

 private static int CalculateCyclomaticComplexity(this IMethodDefinition method, PdbReader pdb, IMetadataHost host)
 {
     var methodBody = method.Decompile(pdb, host);
     var cyclomaticComplexityCalculator = new CyclomaticComplexityCalculator();
     cyclomaticComplexityCalculator.Traverse(methodBody.Statements());
     return cyclomaticComplexityCalculator.Result;
 }
开发者ID:halllo,项目名称:MTSS12,代码行数:7,代码来源:CyclomaticComplexityOfAst.cs

示例7: AnalyzeFileInHost

 private static void AnalyzeFileInHost(string toAnalyse, IMetadataHost host)
 {
     AnalyzeFileWithPdb(toAnalyse, host, (pdb) =>
     {
         AnalyzeAssembly(host.LoadUnitFrom(toAnalyse) as IAssembly, pdb);
     });
 }
开发者ID:halllo,项目名称:MTSS12,代码行数:7,代码来源:Program.cs

示例8: AnalyzeAssemblyInHost

 private void AnalyzeAssemblyInHost(IMetadataHost host, IAssembly assembly, string pdbPath)
 {
     if (pdbPath != null)
         AnalyzeAssemblyInHostWithProgramDatabase(assembly, host, pdbPath);
     else
         AnalyzeTypes(assembly, null, host, Report);
 }
开发者ID:halllo,项目名称:MTSS12,代码行数:7,代码来源:AssemblyVisitor.cs

示例9: SpecifiedMethodCallRegistrar

 public SpecifiedMethodCallRegistrar(IMetadataHost host, ILogger log, ReplacementRegistry registry)
 {
     this.host = host;
     this.log = log;
     this.registry = registry;
     reflector = new UnitReflector(host);
 }
开发者ID:jamarchist,项目名称:SharpMock,代码行数:7,代码来源:SpecifiedMethodCallRegistrar.cs

示例10: TypeAndMethods

 private TypeMetricsWithMethodMetrics TypeAndMethods(PdbReader pdb, IMetadataHost host, INamedTypeDefinition type)
 {
     var typeAndMethods = new TypeMetricsWithMethodMetrics();
     typeAndMethods.AddMethodReports(AnalyzeMethods(type, pdb, host));
     typeAndMethods.Type = AnalyzeType(type, pdb, typeAndMethods.Methods);
     return typeAndMethods;
 }
开发者ID:usus,项目名称:Usus.NET,代码行数:7,代码来源:TypeVisitor.cs

示例11: Decompile

 public static SourceMethodBody Decompile(this IMethodDefinition method, PdbReader pdb, IMetadataHost host)
 {
     return new SourceMethodBody(method.Body, host, pdb, pdb,
                DecompilerOptions.Loops |
                DecompilerOptions.AnonymousDelegates |
                DecompilerOptions.Iterators);
 }
开发者ID:halllo,项目名称:MTSS12,代码行数:7,代码来源:MethodExtensions.cs

示例12: Reachable

    internal static void Reachable(
      IMetadataHost host,
      ISlice<MethodReferenceAdaptor, FieldReferenceAdaptor, TypeReferenceAdaptor, IAssemblyReference> slice,
      HashSet<object> thingsToKeep,
      HashSet<uint> methodsWhoseBodiesShouldBeKept,
      out Dictionary<IMethodDefinition, uint> contractOffsets
      ) {

      Contract.Requires(host != null);
      Contract.Requires(slice != null);
      Contract.Requires(thingsToKeep != null);
      Contract.Requires(methodsWhoseBodiesShouldBeKept != null);

      var traverser = new MetadataTraverser();
      var me = new FindReachable(host, traverser, slice, thingsToKeep, methodsWhoseBodiesShouldBeKept);
      traverser.TraverseIntoMethodBodies = true;
      traverser.PreorderVisitor = me;

      var methodsToTraverse = slice.Methods;
      foreach (var m in methodsToTraverse) {
        var methodDefinition = m.reference.ResolvedMethod;
        traverser.Traverse(methodDefinition);
      }

      foreach (var c in slice.Chains) {
        VisitChain(c, traverser);
      }
      contractOffsets = me.contractOffsets;
      return;
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:30,代码来源:FindReachable.cs

示例13: RewriteModule

        public static IModule RewriteModule(IMetadataHost host, ILocalScopeProvider localScopeProvider, ISourceLocationProvider sourceLocationProvider, IModule module)
        {
            var m = new PropertyChangedWeaver(host);
            m._rewriter = new ReferenceReplacementRewriter(host, localScopeProvider, sourceLocationProvider);

            return m.Rewrite(module);
        }
开发者ID:robocoder,项目名称:aphid,代码行数:7,代码来源:PropertyChangedWeaver.cs

示例14: Of

 public static int Of(IMethodDefinition method, PdbReader pdb, IMetadataHost host)
 {
     if (method.HasOperations())
         return method.CalculateStatements(pdb, host);
     else
         return 0;
 }
开发者ID:cessor,项目名称:MTSS12,代码行数:7,代码来源:NumberOfStatements.cs

示例15: SharpMockTypes

        public SharpMockTypes(IMetadataHost host)
        {
            var funcs = new Dictionary<int, INamedTypeReference>();
            var acts = new Dictionary<int, INamedTypeReference>();

            var sharpMockTypes =
                host.LoadUnitFrom(
                    System.Reflection.Assembly.GetExecutingAssembly().Location);
            var sharpMockDelegateTypes = sharpMockTypes as IAssembly;
            Unit = sharpMockTypes;

            foreach (var type in sharpMockDelegateTypes.GetAllTypes())
            {
                if (type.Name.Value == "VoidAction")
                {
                    acts.Add(type.GenericParameterCount, type);
                }

                if (type.Name.Value == "Function")
                {
                    funcs.Add(type.GenericParameterCount - 1, type);
                }
            }

            functions = new GenericMethodTypeDictionary(funcs, "Unable to find type Function<> with {0} input parameter arguments.");
            actions = new GenericMethodTypeDictionary(acts, "Unable to find type VoidAction<> with {0} parameter arguments.");
        }
开发者ID:jamarchist,项目名称:SharpMock,代码行数:27,代码来源:SharpMockTypes.cs


注:本文中的IMetadataHost类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。