Пример #1
0
        static void ReadScopeAndLocals(ISymbolScope scope, Cil.Scope parent, Cil.MethodBody body, IDictionary instructions)
        {
            Cil.Scope s = new Cil.Scope();
            s.Start = GetInstruction(body, instructions, scope.StartOffset);
            s.End   = GetInstruction(body, instructions, scope.EndOffset);

            if (parent != null)
            {
                parent.Scopes.Add(s);
            }
            else
            {
                body.Scopes.Add(s);
            }

            foreach (ISymbolVariable local in scope.GetLocals())
            {
                Cil.VariableDefinition variable = body.Variables [local.AddressField1];
                variable.Name = local.Name;

                s.Variables.Add(variable);
            }

            foreach (ISymbolScope child in scope.GetChildren())
            {
                ReadScopeAndLocals(child, s, body, instructions);
            }
        }
Пример #2
0
		static void ReadScopeAndLocals (ISymbolScope scope, Cil.Scope parent, Cil.MethodBody body, IDictionary instructions)
		{
			Cil.Scope s = new Cil.Scope ();
			s.Start = GetInstruction (body, instructions, scope.StartOffset);
			s.End = GetInstruction (body, instructions, scope.EndOffset);

			if (parent != null)
				parent.Scopes.Add (s);
			else
				body.Scopes.Add (s);

			foreach (ISymbolVariable local in scope.GetLocals ()) {
				Cil.VariableDefinition variable = body.Variables [local.AddressField1];
				variable.Name = local.Name;

				s.Variables.Add (variable);
			}

			foreach (ISymbolScope child in scope.GetChildren ())
				ReadScopeAndLocals (child, s, body, instructions);
		}