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


C# MethodEntry.GetLocals方法代码示例

本文整理汇总了C#中Mono.CompilerServices.SymbolWriter.MethodEntry.GetLocals方法的典型用法代码示例。如果您正苦于以下问题:C# MethodEntry.GetLocals方法的具体用法?C# MethodEntry.GetLocals怎么用?C# MethodEntry.GetLocals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.CompilerServices.SymbolWriter.MethodEntry的用法示例。


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

示例1: ReadLocalVariables

		void ReadLocalVariables (MethodEntry entry, MethodBody body)
		{
			LocalVariableEntry[] locals = entry.GetLocals ();
			foreach (LocalVariableEntry loc in locals) {
				VariableDefinition var = body.Variables [loc.Index];
				var.Name = loc.Name;

				Scope scope = m_scopes [loc.BlockIndex] as Scope;
				if (scope == null)
					continue;
				scope.Variables.Add (var);
			}
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:13,代码来源:MdbReader.cs

示例2: ReadLocalVariables

		static void ReadLocalVariables (MethodEntry entry, MethodBody body, Scope [] scopes)
		{
			var locals = entry.GetLocals ();
			foreach (var local in locals) {
				var variable = body.Variables [local.Index];
				variable.Name = local.Name;

				var index = local.BlockIndex;
				if (index < 0 || index >= scopes.Length)
					continue;

				var scope = scopes [index];
				if (scope == null)
					continue;

				scope.Variables.Add (variable);
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:18,代码来源:MdbReader.cs

示例3: ReadLocalVariables

		private static void ReadLocalVariables(MethodEntry entry, MethodBody body, Scope[] scopes)
		{
			LocalVariableEntry[] locals = entry.GetLocals();
			LocalVariableEntry[] array = locals;
			for (int i = 0; i < array.Length; i++)
			{
				LocalVariableEntry local = array[i];
				VariableDefinition variable = body.Variables[local.Index];
				variable.Name = local.Name;
				int index = local.BlockIndex;
				if (index >= 0 && index < scopes.Length)
				{
					Scope scope = scopes[index];
					if (scope != null)
					{
						scope.Variables.Add(variable);
					}
				}
			}
		}
开发者ID:qq1792,项目名称:LSharp,代码行数:20,代码来源:MdbReader.cs

示例4: ReadLocalVariables

		static void ReadLocalVariables (MethodEntry entry, MethodSymbols symbols)
		{
			foreach (var local in entry.GetLocals ()) {
				if (local.Index < 0 || local.Index >= symbols.Variables.Count) // Mono 2.6 emits wrong local infos for iterators
					continue;

				var variable = symbols.Variables [local.Index];
				variable.Name = local.Name;
			}
		}
开发者ID:0xb1dd1e,项目名称:cecil,代码行数:10,代码来源:MdbReader.cs

示例5: ReadLocalVariables

        static void ReadLocalVariables(MethodEntry entry, ScopeDebugInformation [] scopes)
        {
            var locals = entry.GetLocals ();

            foreach (var local in locals) {
                var variable = new VariableDebugInformation (local.Index, local.Name);

                var index = local.BlockIndex;
                if (index < 0 || index >= scopes.Length)
                    continue;

                var scope = scopes [index];
                if (scope == null)
                    continue;

                scope.Variables.Add (variable);
            }
        }
开发者ID:jbevain,项目名称:cecil,代码行数:18,代码来源:MdbReader.cs

示例6: CheckMethod

        protected void CheckMethod(MethodEntry method)
        {
            Cecil.MethodDefinition mdef = (Cecil.MethodDefinition) Assembly.MainModule.LookupByToken (
                Cecil.Metadata.TokenType.Method, method.Token & 0xffffff);
            if ((mdef == null) || (mdef.Body == null))
                throw new MonoSymbolFileException ("Method {0} (token {1:x}) not found in assembly.",
                                   method.Index, method.Token);

            string name = String.Format ("{0} ({1})", method.Index, GetMethodName (mdef));
            Debug ("[Method {0} - {1} - {2}]", method.Index, method.CompileUnit.SourceFile.FileName,
                   GetMethodName (mdef));

            LineNumberTable lnt = method.GetLineNumberTable ();
            if (lnt == null)
                throw new MonoSymbolFileException ("Cannot get LNT from method {0}.", name);

            if (lnt.LineNumbers == null)
                throw new MonoSymbolFileException ("Cannot get LNT from method {0}.", name);
            LineNumberEntry start, end;
            if (lnt.GetMethodBounds (out start, out end))
                Debug ("  Bounds: {0} {1}", start, end);
            foreach (LineNumberEntry line in lnt.LineNumbers)
                Debug ("    Line: {0}", line);

            CodeBlockEntry[] blocks = method.GetCodeBlocks () ?? new CodeBlockEntry [0];
            foreach (CodeBlockEntry block in blocks) {
                if ((block.Parent >= 0) && (block.Parent >= blocks.Length))
                    throw new MonoSymbolFileException (
                        "Code block {0} in method {1} has invalid parent index {2} (valid is 0..{3}).",
                        block, name, block.Parent, blocks.Length);
            }

            LocalVariableEntry[] locals = method.GetLocals () ?? new LocalVariableEntry [0];
            foreach (LocalVariableEntry local in locals) {
                if ((local.BlockIndex < 0) || ((local.BlockIndex > 0) && (local.BlockIndex > blocks.Length)))
                    throw new MonoSymbolFileException (
                        "Local variable {0} in method {1} has invalid block index {2} (valid is 0..{3}).",
                        local, name, local.BlockIndex, blocks.Length);

                Debug ("  Local: {0}", local);
            }

            int num_locals = mdef.Body.Variables.Count;

            ScopeVariable[] scope_vars = method.GetScopeVariables () ?? new ScopeVariable [0];
            foreach (ScopeVariable var in scope_vars) {
                Debug ("  Scope var: {0}", var);
                if ((mdef.IsStatic) && (var.Index < 0))
                    throw new MonoSymbolFileException (
                        "Method {0} has invalid scope variable {1} (referencing `this' in static method).",
                        name, var);
                if ((var.Index >= 0) && (var.Index >= num_locals))
                    throw new MonoSymbolFileException (
                        "Method {0} has invalid scope variable {1} (index out of bounds: {2} / {3}).",
                        name, var, var.Index, num_locals);
                if ((var.Scope > 0) && (File.GetAnonymousScope (var.Scope) == null))
                    throw new MonoSymbolFileException (
                        "Method {0} has invalid scope variable {1} (can't find scope {2}).",
                        name, var, var.Scope);
            }
        }
开发者ID:baulig,项目名称:debugger,代码行数:61,代码来源:MdbSymbolReader.cs

示例7: PrintLocals

        public void PrintLocals(MethodEntry method)
        {
            CodeBlockEntry[] blocks = method.GetCodeBlocks () ?? new CodeBlockEntry [0];
            foreach (CodeBlockEntry block in blocks) {
                Message ("  CodeBlock {0}", block);
            }

            LocalVariableEntry[] locals = method.GetLocals () ?? new LocalVariableEntry [0];
            foreach (LocalVariableEntry local in locals) {
                Message ("  Local {0}", local);
            }
        }
开发者ID:baulig,项目名称:debugger,代码行数:12,代码来源:MdbSymbolReader.cs


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