Пример #1
0
		void CreateScopes (MethodBody body, ScopeCollection scopes, SymbolToken localVarToken)
		{
			foreach (Scope s in scopes) {
				int startOffset = s.Start.Offset;
				int endOffset = s.End == body.Instructions.Outside ?
					body.Instructions[body.Instructions.Count - 1].Offset + 1 :
					s.End.Offset;

				m_writer.OpenScope (startOffset);
				m_writer.UsingNamespace (body.Method.DeclaringType.Namespace);
				m_writer.OpenNamespace (body.Method.DeclaringType.Namespace);

				int start = body.Instructions.IndexOf (s.Start);
				int end = s.End == body.Instructions.Outside ?
					body.Instructions.Count - 1 :
					body.Instructions.IndexOf (s.End);

				ArrayList instructions = CollectSequencePoints (body, start, end);
				DefineSequencePoints (instructions);

				CreateLocalVariable (s, startOffset, endOffset, localVarToken);

				CreateScopes (body, s.Scopes, localVarToken);
				m_writer.CloseNamespace ();

				m_writer.CloseScope (endOffset);
			}
		}
Пример #2
0
 public MethodBody(MethodDefinition meth)
 {
     m_method = meth;
     m_instructions = new InstructionCollection (this);
     m_exceptions = new ExceptionHandlerCollection (this);
     m_variables = new VariableDefinitionCollection (this);
     m_scopes = new ScopeCollection (this);
 }
 public MethodBody(MethodDefinition meth)
 {
     m_method       = meth;
     m_instructions = new InstructionCollection(this);
     m_exceptions   = new ExceptionHandlerCollection(this);
     m_variables    = new VariableDefinitionCollection(this);
     m_scopes       = new ScopeCollection(this);
 }
		public void VisitScopeCollection (ScopeCollection scopes)
		{
			VisitCollection (scopes);
		}
        public void VisitScopeCollection(ScopeCollection scopes)
        {
#warning: NotImplementedException
        }
Пример #6
0
 public override void VisitScopeCollection(ScopeCollection scopes) { }
Пример #7
0
 public override void VisitScopeCollection(ScopeCollection scopes)
 {
     base.VisitScopeCollection(scopes);
 }
Пример #8
0
        void CreateScopes(MethodBody body, ScopeCollection scopes, byte [][] variables)
        {
            foreach (Scope s in scopes) {
                int startOffset = s.Start.Offset;
                int endOffset = s.End == body.Instructions.Outside ?
                    body.Instructions[body.Instructions.Count - 1].Offset + 1 :
                    s.End.Offset;

                m_writer.OpenScope (startOffset);
                m_writer.UsingNamespace (body.Method.DeclaringType.Namespace);
                m_writer.OpenNamespace (body.Method.DeclaringType.Namespace);

                int start = body.Instructions.IndexOf (s.Start);
                int end = s.End == body.Instructions.Outside ?
                    body.Instructions.Count - 1 :
                    body.Instructions.IndexOf (s.End);

                ArrayList instructions = new ArrayList();
                for (int i = start; i <= end; i++)
                    if (body.Instructions [i].SequencePoint != null)
                        instructions.Add (body.Instructions [i]);

                Document doc = null;

                int [] offsets = new int [instructions.Count];
                int [] startRows = new int [instructions.Count];
                int [] startCols = new int [instructions.Count];
                int [] endRows = new int [instructions.Count];
                int [] endCols = new int [instructions.Count];

                for (int i = 0; i < instructions.Count; i++) {
                    Instruction instr = (Instruction) instructions [i];
                    offsets [i] = instr.Offset;

                    if (doc == null)
                        doc = instr.SequencePoint.Document;

                    startRows [i] = instr.SequencePoint.StartLine;
                    startCols [i] = instr.SequencePoint.StartColumn;
                    endRows [i] = instr.SequencePoint.EndLine;
                    endCols [i] = instr.SequencePoint.EndColumn;
                }

                m_writer.DefineSequencePoints (GetDocument (doc),
                    offsets, startRows, startCols, endRows, endCols);

                CreateLocalVariable (s, startOffset, endOffset, variables);

                CreateScopes (body, s.Scopes, variables);
                m_writer.CloseNamespace ();

                m_writer.CloseScope (endOffset);
            }
        }