Example #1
0
 public MethodBody(
     byte[] ilBits,
     ushort maxStack,
     Cci.IMethodDefinition parent,
     ImmutableArray <LocalDefinition> locals,
     SequencePointList sequencePoints,
     DebugDocumentProvider debugDocumentProvider,
     ImmutableArray <Cci.ExceptionHandlerRegion> exceptionHandlers,
     ImmutableArray <LocalScope> localScopes,
     Cci.CustomDebugInfoKind customDebugInfoKind,
     bool hasDynamicLocalVariables,
     ImmutableArray <NamespaceScope> namespaceScopes = default(ImmutableArray <NamespaceScope>),
     string iteratorClassName = null,
     ImmutableArray <LocalScope> iteratorScopes        = default(ImmutableArray <LocalScope>),
     Cci.AsyncMethodBodyDebugInfo asyncMethodDebugInfo = null)
 {
     this.ilBits = ilBits;
     this.asyncMethodDebugInfo = asyncMethodDebugInfo;
     this.maxStack             = maxStack;
     this.parent                   = parent;
     this.locals                   = locals;
     this.sequencePoints           = sequencePoints;
     this.debugDocumentProvider    = debugDocumentProvider;
     this.exceptionHandlers        = exceptionHandlers;
     this.localScopes              = localScopes;
     this.customDebugInfoKind      = customDebugInfoKind;
     this.hasDynamicLocalVariables = hasDynamicLocalVariables;
     this.namespaceScopes          = namespaceScopes.IsDefault ? ImmutableArray <NamespaceScope> .Empty : namespaceScopes;
     this.iteratorClassName        = iteratorClassName;
     this.iteratorScopes           = iteratorScopes.IsDefault ? ImmutableArray <LocalScope> .Empty : iteratorScopes;
 }
Example #2
0
 public MethodBody(
     byte[] ilBits,
     ushort maxStack,
     Cci.IMethodDefinition parent,
     ImmutableArray<LocalDefinition> locals,
     SequencePointList sequencePoints,
     DebugDocumentProvider debugDocumentProvider,
     ImmutableArray<Cci.ExceptionHandlerRegion> exceptionHandlers,
     ImmutableArray<LocalScope> localScopes,
     Cci.CustomDebugInfoKind customDebugInfoKind,
     bool hasDynamicLocalVariables,
     ImmutableArray<NamespaceScope> namespaceScopes = default(ImmutableArray<NamespaceScope>),
     string iteratorClassName = null,
     ImmutableArray<LocalScope> iteratorScopes = default(ImmutableArray<LocalScope>),
     Cci.AsyncMethodBodyDebugInfo asyncMethodDebugInfo = null)
 {
     this.ilBits = ilBits;
     this.asyncMethodDebugInfo = asyncMethodDebugInfo;
     this.maxStack = maxStack;
     this.parent = parent;
     this.locals = locals;
     this.sequencePoints = sequencePoints;
     this.debugDocumentProvider = debugDocumentProvider;
     this.exceptionHandlers = exceptionHandlers;
     this.localScopes = localScopes;
     this.customDebugInfoKind = customDebugInfoKind;
     this.hasDynamicLocalVariables = hasDynamicLocalVariables;
     this.namespaceScopes = namespaceScopes.IsDefault ? ImmutableArray<NamespaceScope>.Empty : namespaceScopes;
     this.iteratorClassName = iteratorClassName;
     this.iteratorScopes = iteratorScopes.IsDefault ? ImmutableArray<LocalScope>.Empty : iteratorScopes;
 }
Example #3
0
 /// <summary>
 /// Return lazy list of method calls in given method
 /// </summary>
 /// <param name="method"></param>
 /// <returns></returns>
 private IEnumerable <data.MethodCall> ParseMethodCalls(cci.IMethodDefinition method)
 {
     foreach (var callOp in from cci.IOperation op in method.Body.Operations where IsCallOperation(op) select op)
     {
         data.MethodCall call = new data.MethodCall();
         call.TargetName = ParseTargetMethodName(callOp.Value as dynamic);
         call.TargetType = method.ContainingType.ToString(); // relying on a horrible quirk for now
         yield return(call);
     }
 }
Example #4
0
        internal LocalScope(uint begin, uint end, Cci.IMethodDefinition parent, IEnumerable <Cci.ILocalDefinition> constantSymbols, IEnumerable <Cci.ILocalDefinition> localSymbols)
        {
            //we should not create 0-length scopes as they are useless.
            //however we will allow the case of "begin == end" as that is how edge inclusive scopes of length 1 are represented.
            System.Diagnostics.Debug.Assert(begin <= end);

            this.offset          = begin;
            this.length          = end - begin;
            this.parent          = parent;
            this.constantSymbols = constantSymbols;
            this.localSymbols    = localSymbols;
        }
Example #5
0
        internal LocalScope(uint begin, uint end, Cci.IMethodDefinition parent, IEnumerable<Cci.ILocalDefinition> constantSymbols, IEnumerable<Cci.ILocalDefinition> localSymbols)
        {
            //we should not create 0-length scopes as they are useless.
            //however we will allow the case of "begin == end" as that is how edge inclusive scopes of length 1 are represented.
            System.Diagnostics.Debug.Assert(begin <= end);

            this.offset = begin;
            this.length = end - begin;
            this.parent = parent;
            this.constantSymbols = constantSymbols;
            this.localSymbols = localSymbols;
        }
Example #6
0
        private IEnumerable <data.Variable> ParseLocalVariables(cci.IMethodDefinition method, cci.PdbReader symbol)
        {
            IEnumerable <cci.ILocalDefinition> locals;

            if (symbol != null)
            {
                locals = from cci.ILocalDefinition localVar in symbol.GetLocalScopes(method.Body).SelectMany <cci.ILocalScope, cci.ILocalDefinition>(symbol.GetVariablesInScope) select localVar;
            }
            else
            {
                locals = method.Body.LocalVariables;
            }
            foreach (cci.ILocalDefinition local in locals)
            {
                data.Variable variable = new data.Variable();
                variable.Name = local.Name.Value;
                variable.Type = ParseTypeName(local.Type);
                yield return(variable);
            }
        }
Example #7
0
 public void Inspect(cci.IAssembly assembly, cci.INamedTypeDefinition type, cci.IMethodDefinition method, cci.PdbReader symbol)
 {
     data.MethodInfo info = new data.MethodInfo();
     info.MethodCalls = ParseMethodCalls(method);
 }
Example #8
0
 public MethodImplementation(Cci.IMethodDefinition implementing, Cci.IMethodReference implemented)
 {
     this.implementing = implementing;
     this.implemented = implemented;
 }
Example #9
0
 public MethodImplementation(Cci.IMethodDefinition implementing, Cci.IMethodReference implemented)
 {
     this.implementing = implementing;
     this.implemented  = implemented;
 }