• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ILBlock类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: RunStep1

		public static void RunStep1(DecompilerContext context, ILBlock method)
		{
			if (!context.Settings.AsyncAwait)
				return; // abort if async decompilation is disabled
			var yrd = new AsyncDecompiler();
			yrd.context = context;
			if (!yrd.MatchTaskCreationPattern(method))
				return;
			#if DEBUG
			if (Debugger.IsAttached) {
				yrd.Run();
			} else {
				#endif
				try {
					yrd.Run();
				} catch (SymbolicAnalysisFailedException) {
					return;
				}
				#if DEBUG
			}
			#endif
			context.CurrentMethodIsAsync = true;
			
			method.Body.Clear();
			method.EntryGoto = null;
			method.Body.AddRange(yrd.newTopLevelBody);
			ILAstOptimizer.RemoveRedundantCode(method);
		}
开发者ID:FaceHunter,项目名称:ILSpy,代码行数:28,代码来源:AsyncDecompiler.cs


示例2: ILBlockTranslator

        public ILBlockTranslator(AssemblyTranslator translator, DecompilerContext context, MethodReference methodReference, MethodDefinition methodDefinition, ILBlock ilb, IEnumerable<ILVariable> parameters, IEnumerable<ILVariable> allVariables)
        {
            Translator = translator;
            Context = context;
            ThisMethodReference = methodReference;
            ThisMethod = methodDefinition;
            Block = ilb;

            SpecialIdentifiers = new JSIL.SpecialIdentifiers(TypeSystem);

            if (methodReference.HasThis)
                Variables.Add("this", JSThisParameter.New(methodReference.DeclaringType, methodReference));

            foreach (var parameter in parameters) {
                if ((parameter.Name == "this") && (parameter.OriginalParameter.Index == -1))
                    continue;

                ParameterNames.Add(parameter.Name);
                Variables.Add(parameter.Name, new JSParameter(parameter.Name, parameter.Type, methodReference));
            }

            foreach (var variable in allVariables) {
                var v = JSVariable.New(variable, methodReference);
                if (Variables.ContainsKey(v.Identifier)) {
                    v = new JSVariable(variable.OriginalVariable.Name, variable.Type, methodReference);
                    RenamedVariables[variable] = v;
                    Variables.Add(v.Identifier, v);
                } else {
                    Variables.Add(v.Identifier, v);
                }
            }
        }
开发者ID:aprishchepov,项目名称:JSIL,代码行数:32,代码来源:ILBlockTranslator.cs


示例3: Run

		public static void Run(DecompilerContext context, ILBlock method, List<ILNode> list_ILNode, Func<ILBlock, ILInlining> getILInlining)
		{
			if (!context.Settings.YieldReturn)
				return; // abort if enumerator decompilation is disabled
			var yrd = new YieldReturnDecompiler();
			yrd.context = context;
			if (!yrd.MatchEnumeratorCreationPattern(method))
				return;
			yrd.enumeratorType = yrd.enumeratorCtor.DeclaringType;
			#if DEBUG && CRASH_IN_DEBUG_MODE
			if (Debugger.IsAttached) {
				yrd.Run();
			} else {
				#endif
				try {
					yrd.Run();
				} catch (SymbolicAnalysisFailedException) {
					return;
				}
				#if DEBUG && CRASH_IN_DEBUG_MODE
			}
			#endif
			method.Body.Clear();
			method.EntryGoto = null;
			method.Body.AddRange(yrd.newBody);//TODO: Make sure that the removed ILRanges from Clear() above is saved in the new body
			
			// Repeat the inlining/copy propagation optimization because the conversion of field access
			// to local variables can open up additional inlining possibilities.
			var inlining = getILInlining(method);
			inlining.InlineAllVariables();
			inlining.CopyPropagation(list_ILNode);
		}
开发者ID:levisre,项目名称:dnSpy,代码行数:32,代码来源:YieldReturnDecompiler.cs


示例4: CreateMethodBody

        public BlockStatement CreateMethodBody()
        {
            if (methodDef.Body == null) return null;

            context.CancellationToken.ThrowIfCancellationRequested();
            ILBlock ilMethod = new ILBlock();
            ILAstBuilder astBuilder = new ILAstBuilder();
            ilMethod.Body = astBuilder.Build(methodDef, true);

            context.CancellationToken.ThrowIfCancellationRequested();
            ILAstOptimizer bodyGraph = new ILAstOptimizer();
            bodyGraph.Optimize(context, ilMethod);
            context.CancellationToken.ThrowIfCancellationRequested();

            NameVariables.AssignNamesToVariables(methodDef.Parameters.Select(p => p.Name), astBuilder.Variables, ilMethod);

            context.CancellationToken.ThrowIfCancellationRequested();
            Ast.BlockStatement astBlock = TransformBlock(ilMethod);
            CommentStatement.ReplaceAll(astBlock); // convert CommentStatements to Comments
            foreach (ILVariable v in localVariablesToDefine) {
                DeclareVariableInSmallestScope.DeclareVariable(astBlock, AstBuilder.ConvertType(v.Type), v.Name);
            }

            return astBlock;
        }
开发者ID:richardschneider,项目名称:ILSpy,代码行数:25,代码来源:AstMethodBodyBuilder.cs


示例5: VisitBlock

    protected override ILBlock VisitBlock(ILBlock block)
    {
        currentScope++;

        var result = base.VisitBlock(block);

        currentScope--;

        if (block.Body.Count == 0)
            return result;

        var toOffset = block.LastILOffset();

        if (toOffset < 0)
            return result;

        foreach (var start in starts.Where(kvp => kvp.Key.Item2 == currentScope + 1).ToList())
        {
            starts.Remove(start.Key);

            List<ILExpression> args;
            if (block.Body.Last().Match(ILCode.Ret, out args) && args.Count == 1 && args[0].MatchLdloc(start.Key.Item1))
                continue; // Returning the variable

            UsingRanges.Add(new ILRange { From = start.Value, To = toOffset });
        }

        return result;
    }
开发者ID:ropean,项目名称:Usable,代码行数:29,代码来源:UsableVisitor.cs


示例6: RemoveGotos

		public void RemoveGotos(ILBlock method)
		{
			// Build the navigation data
			parent[method] = null;
			foreach (ILNode node in method.GetSelfAndChildrenRecursive<ILNode>()) {
				ILNode previousChild = null;
				foreach (ILNode child in node.GetChildren()) {
					if (parent.ContainsKey(child))
						throw new Exception("The following expression is linked from several locations: " + child.ToString());
					parent[child] = node;
					if (previousChild != null)
						nextSibling[previousChild] = child;
					previousChild = child;
				}
				if (previousChild != null)
					nextSibling[previousChild] = null;
			}
			
			// Simplify gotos
			bool modified;
			do {
				modified = false;
				foreach (ILExpression gotoExpr in method.GetSelfAndChildrenRecursive<ILExpression>(e => e.Code == ILCode.Br || e.Code == ILCode.Leave)) {
					modified |= TrySimplifyGoto(gotoExpr);
				}
			} while(modified);
			
			RemoveRedundantCode(method);
		}
开发者ID:JustasB,项目名称:cudafy,代码行数:29,代码来源:GotoRemoval.cs


示例7: Run

		public static void Run(DecompilerContext context, ILBlock method)
		{
			if (!context.Settings.YieldReturn)
				return; // abort if enumerator decompilation is disabled
			var yrd = new YieldReturnDecompiler();
			yrd.context = context;
			if (!yrd.MatchEnumeratorCreationPattern(method))
				return;
			yrd.enumeratorType = yrd.enumeratorCtor.DeclaringType;
			#if DEBUG
			if (Debugger.IsAttached) {
				yrd.Run();
			} else {
				#endif
				try {
					yrd.Run();
				} catch (YieldAnalysisFailedException) {
					return;
				}
				#if DEBUG
			}
			#endif
			method.Body.Clear();
			method.EntryGoto = null;
			method.Body.AddRange(yrd.newBody);
		}
开发者ID:hlesesne,项目名称:ILSpy,代码行数:26,代码来源:YieldReturnDecompiler.cs


示例8: Run

		public static void Run(DecompilerContext context, ILBlock method)
		{
			if (!context.Settings.YieldReturn)
				return; // abort if enumerator decompilation is disabled
			var yrd = new YieldReturnDecompiler();
			yrd.context = context;
			if (!yrd.MatchEnumeratorCreationPattern(method))
				return;
			yrd.enumeratorType = yrd.enumeratorCtor.DeclaringType;
			#if DEBUG
			if (Debugger.IsAttached) {
				yrd.Run();
			} else {
				#endif
				try {
					yrd.Run();
				} catch (SymbolicAnalysisFailedException) {
					return;
				}
				#if DEBUG
			}
			#endif
			method.Body.Clear();
			method.EntryGoto = null;
			method.Body.AddRange(yrd.newBody);
			
			// Repeat the inlining/copy propagation optimization because the conversion of field access
			// to local variables can open up additional inlining possibilities.
			ILInlining inlining = new ILInlining(method);
			inlining.InlineAllVariables();
			inlining.CopyPropagation();
		}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:32,代码来源:YieldReturnDecompiler.cs


示例9: Optimize

        public void Optimize(ILBlock method)
        {
            foreach(ILBlock block in method.GetSelfAndChildrenRecursive<ILBlock>().ToList()) {
                SplitToMovableBlocks(block);
            }

            foreach(ILBlock block in method.GetSelfAndChildrenRecursive<ILBlock>().Where(b => !(b is ILMoveableBlock)).ToList()) {
                ControlFlowGraph graph;
                graph = BuildGraph(block.Body, block.EntryPoint);
                graph.ComputeDominance();
                graph.ComputeDominanceFrontier();
                block.Body = FindLoops(new HashSet<ControlFlowNode>(graph.Nodes.Skip(3)), graph.EntryPoint, true);
            }

            foreach(ILBlock block in method.GetSelfAndChildrenRecursive<ILBlock>().Where(b => !(b is ILMoveableBlock)).ToList()) {
                ControlFlowGraph graph;
                graph = BuildGraph(block.Body, block.EntryPoint);
                graph.ComputeDominance();
                graph.ComputeDominanceFrontier();
                block.Body = FindConditions(new HashSet<ControlFlowNode>(graph.Nodes.Skip(3)), graph.EntryPoint);
            }

            // OrderNodes(method);
            FlattenNestedMovableBlocks(method);
            SimpleGotoRemoval(method);
            RemoveDeadLabels(method);
        }
开发者ID:FriedWishes,项目名称:ILSpy,代码行数:27,代码来源:ILAstOptimizer.cs


示例10: CreateMethodBody

		public BlockStatement CreateMethodBody()
		{
			if (methodDef.Body == null) return null;
			
			context.CancellationToken.ThrowIfCancellationRequested();
			ILBlock ilMethod = new ILBlock();
			ILAstBuilder astBuilder = new ILAstBuilder();
			ilMethod.Body = astBuilder.Build(methodDef, true);
			
			context.CancellationToken.ThrowIfCancellationRequested();
			ILAstOptimizer bodyGraph = new ILAstOptimizer();
			bodyGraph.Optimize(context, ilMethod);
			context.CancellationToken.ThrowIfCancellationRequested();
			
			var allVariables = ilMethod.GetSelfAndChildrenRecursive<ILExpression>().Select(e => e.Operand as ILVariable).Where(v => v != null && !v.IsGenerated).Distinct();
			NameVariables.AssignNamesToVariables(methodDef.Parameters.Select(p => p.Name), allVariables, ilMethod);
			
			context.CancellationToken.ThrowIfCancellationRequested();
			Ast.BlockStatement astBlock = TransformBlock(ilMethod);
			CommentStatement.ReplaceAll(astBlock); // convert CommentStatements to Comments
			foreach (ILVariable v in localVariablesToDefine) {
				DeclareVariableInSmallestScope.DeclareVariable(astBlock, AstBuilder.ConvertType(v.Type), v.Name);
			}
			
			return astBlock;
		}
开发者ID:hlesesne,项目名称:ILSpy,代码行数:26,代码来源:AstMethodBodyBuilder.cs


示例11: DecompileMethod

		public override void DecompileMethod(MethodDefinition method, ITextOutput output, DecompilationOptions options)
		{
			if (!method.HasBody) {
				return;
			}
			
			ILAstBuilder astBuilder = new ILAstBuilder();
			ILBlock ilMethod = new ILBlock();
			ilMethod.Body = astBuilder.Build(method, inlineVariables);
			
			if (abortBeforeStep != null) {
				DecompilerContext context = new DecompilerContext(method.Module) { CurrentType = method.DeclaringType, CurrentMethod = method };
				new ILAstOptimizer().Optimize(context, ilMethod, abortBeforeStep.Value);
			}
			
			var allVariables = ilMethod.GetSelfAndChildrenRecursive<ILExpression>().Select(e => e.Operand as ILVariable)
				.Where(v => v != null && !v.IsParameter).Distinct();
			foreach (ILVariable v in allVariables) {
				output.WriteDefinition(v.Name, v);
				if (v.Type != null) {
					output.Write(" : ");
					if (v.IsPinned)
						output.Write("pinned ");
					v.Type.WriteTo(output, ILNameSyntax.ShortTypeName);
				}
				output.WriteLine();
			}
			output.WriteLine();
			
			foreach (ILNode node in ilMethod.Body) {
				node.WriteTo(output);
				output.WriteLine();
			}
		}
开发者ID:rmattuschka,项目名称:ILSpy,代码行数:34,代码来源:ILAstLanguage.cs


示例12: DecompileMethod

		public override void DecompileMethod(MethodDef method, ITextOutput output, DecompilationOptions options)
		{
			WriteComment(output, "Method: ");
			output.WriteDefinition(IdentifierEscaper.Escape(method.FullName), method, TextTokenType.Comment, false);
			output.WriteLine();

			if (!method.HasBody) {
				return;
			}
			
			StartKeywordBlock(output, ".body", method);

			ILAstBuilder astBuilder = new ILAstBuilder();
			ILBlock ilMethod = new ILBlock();
			DecompilerContext context = new DecompilerContext(method.Module) { CurrentType = method.DeclaringType, CurrentMethod = method };
			ilMethod.Body = astBuilder.Build(method, inlineVariables, context);
			
			if (abortBeforeStep != null) {
				new ILAstOptimizer().Optimize(context, ilMethod, abortBeforeStep.Value);
			}
			
			if (context.CurrentMethodIsAsync) {
				output.Write("async", TextTokenType.Keyword);
				output.Write('/', TextTokenType.Operator);
				output.WriteLine("await", TextTokenType.Keyword);
			}
			
			var allVariables = ilMethod.GetSelfAndChildrenRecursive<ILExpression>().Select(e => e.Operand as ILVariable)
				.Where(v => v != null && !v.IsParameter).Distinct();
			foreach (ILVariable v in allVariables) {
				output.WriteDefinition(IdentifierEscaper.Escape(v.Name), v, v.IsParameter ? TextTokenType.Parameter : TextTokenType.Local);
				if (v.Type != null) {
					output.WriteSpace();
					output.Write(':', TextTokenType.Operator);
					output.WriteSpace();
					if (v.IsPinned) {
						output.Write("pinned", TextTokenType.Keyword);
						output.WriteSpace();
					}
					v.Type.WriteTo(output, ILNameSyntax.ShortTypeName);
				}
				if (v.IsGenerated) {
					output.WriteSpace();
					output.Write('[', TextTokenType.Operator);
					output.Write("generated", TextTokenType.Keyword);
					output.Write(']', TextTokenType.Operator);
				}
				output.WriteLine();
			}
			
			var memberMapping = new MemberMapping(method);
			foreach (ILNode node in ilMethod.Body) {
				node.WriteTo(output, memberMapping);
				if (!node.WritesNewLine)
					output.WriteLine();
			}
			output.AddDebugSymbols(memberMapping);
			EndKeywordBlock(output);
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:59,代码来源:ILAstLanguage.cs


示例13: AssignNamesToVariables

 public static void AssignNamesToVariables(IEnumerable<string> existingNames, IEnumerable<ILVariable> variables, ILBlock methodBody)
 {
     NameVariables nv = new NameVariables();
     nv.AddExistingNames(existingNames);
     foreach (ILVariable varDef in variables) {
         nv.AssignNameToVariable(varDef, methodBody.GetSelfAndChildrenRecursive<ILExpression>());
     }
 }
开发者ID:petr-k,项目名称:ILSpy,代码行数:8,代码来源:NameVariables.cs


示例14: InlineIfPossible

		/// <summary>
		/// Inlines the stloc instruction at block.Body[pos] into the next instruction, if possible.
		/// </summary>
		public static bool InlineIfPossible(ILBlock block, int pos, ILBlock method)
		{
			if (InlineIfPossible((ILExpression)block.Body[pos], block.Body.ElementAtOrDefault(pos+1), method)) {
				block.Body.RemoveAt(pos);
				return true;
			}
			return false;
		}
开发者ID:hlesesne,项目名称:ILSpy,代码行数:11,代码来源:ILInlining.cs


示例15: TransformBlock

		Ast.BlockStatement TransformBlock(ILBlock block)
		{
			Ast.BlockStatement astBlock = new BlockStatement();
			if (block != null) {
				foreach(ILNode node in block.GetChildren()) {
					astBlock.AddRange(TransformNode(node));
				}
			}
			return astBlock;
		}
开发者ID:hlesesne,项目名称:ILSpy,代码行数:10,代码来源:AstMethodBodyBuilder.cs


示例16: FindConditions

		public void FindConditions(ILBlock block)
		{
			if (block.Body.Count > 0) {
				ControlFlowGraph graph;
				graph = BuildGraph(block.Body, (ILLabel)block.EntryGoto.Operand);
				graph.ComputeDominance(context.CancellationToken);
				graph.ComputeDominanceFrontier();
				block.Body = FindConditions(new HashSet<ControlFlowNode>(graph.Nodes.Skip(3)), graph.EntryPoint);
			}
		}
开发者ID:modulexcite,项目名称:ICSharpCode.Decompiler-retired,代码行数:10,代码来源:LoopsAndConditions.cs


示例17: FindLoops

		public void FindLoops(ILBlock block)
		{
			if (block.Body.Count > 0) {
				ControlFlowGraph graph;
				graph = BuildGraph(block.Body, (ILLabel)block.EntryGoto.Operand);
				graph.ComputeDominance(context.VerifyProgress);
				graph.ComputeDominanceFrontier();
				block.Body = FindLoops(new HashSet<ControlFlowNode>(graph.Nodes.Skip(3)), graph.EntryPoint, false);
			}
		}
开发者ID:BGCX261,项目名称:zoom-decompiler-hg-to-git,代码行数:10,代码来源:LoopsAndConditions.cs


示例18: Run

 public static void Run(DecompilerContext context, ILBlock method)
 {
     TypeAnalysis ta = new TypeAnalysis();
     ta.context = context;
     ta.module = context.CurrentMethod.Module;
     ta.typeSystem = ta.module.TypeSystem;
     ta.method = method;
     ta.InferTypes(method);
     ta.InferRemainingStores();
 }
开发者ID:petr-k,项目名称:ILSpy,代码行数:10,代码来源:TypeAnalysis.cs


示例19: CreateMethodBody

        public BlockStatement CreateMethodBody()
        {
            if (methodDef.Body == null) return null;

            ILBlock ilMethod = new ILBlock();
            ILAstBuilder astBuilder = new ILAstBuilder();
            ilMethod.Body = astBuilder.Build(methodDef, true);

            ILAstOptimizer bodyGraph = new ILAstOptimizer();
            bodyGraph.Optimize(ilMethod);

            List<string> intNames = new List<string>(new string[] {"i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t"});
            Dictionary<string, int> typeNames = new Dictionary<string, int>();
            foreach(ILVariable varDef in astBuilder.Variables) {
                if (varDef.Type.FullName == Constants.Int32 && intNames.Count > 0) {
                    varDef.Name = intNames[0];
                    intNames.RemoveAt(0);
                } else {
                    string name;
                    if (varDef.Type.IsArray) {
                        name = "array";
                    } else if (!typeNameToVariableNameDict.TryGetValue(varDef.Type.FullName, out name)) {
                        name = varDef.Type.Name;
                        // remove the 'I' for interfaces
                        if (name.Length >= 3 && name[0] == 'I' && char.IsUpper(name[1]) && char.IsLower(name[2]))
                            name = name.Substring(1);
                        // remove the backtick (generics)
                        int pos = name.IndexOf('`');
                        if (pos >= 0)
                            name = name.Substring(0, pos);
                        if (name.Length == 0)
                            name = "obj";
                        else
                            name = char.ToLower(name[0]) + name.Substring(1);
                    }
                    if (!typeNames.ContainsKey(name)) {
                        typeNames.Add(name, 0);
                    }
                    int count = ++(typeNames[name]);
                    if (count > 1) {
                        name += count.ToString();
                    }
                    varDef.Name = name;
                }

            //				Ast.VariableDeclaration astVar = new Ast.VariableDeclaration(varDef.Name);
            //				Ast.LocalVariableDeclaration astLocalVar = new Ast.LocalVariableDeclaration(astVar);
            //				astLocalVar.TypeReference = new Ast.TypeReference(varDef.VariableType.FullName);
            //				astBlock.Children.Add(astLocalVar);
            }

            Ast.BlockStatement astBlock = TransformBlock(ilMethod);
            CommentStatement.ReplaceAll(astBlock); // convert CommentStatements to Comments
            return astBlock;
        }
开发者ID:HEskandari,项目名称:ILSpy,代码行数:55,代码来源:AstMethodBodyBuilder.cs


示例20: Transform

        public static void Transform(ILBlock method)
        {
            // TODO: move this somewhere else
            // Eliminate 'dups':
            foreach (ILExpression expr in method.GetSelfAndChildrenRecursive<ILExpression>()) {
                for (int i = 0; i < expr.Arguments.Count; i++) {
                    if (expr.Arguments[i].Code == ILCode.Dup)
                        expr.Arguments[i] = expr.Arguments[i].Arguments[0];
                }
            }

            var newArrPattern = new StoreToVariable(new ILExpression(ILCode.Newarr, ILExpression.AnyOperand, new ILExpression(ILCode.Ldc_I4, ILExpression.AnyOperand)));
            var arg1 = new StoreToVariable(new LoadFromVariable(newArrPattern)) { MustBeGenerated = true };
            var arg2 = new StoreToVariable(new LoadFromVariable(newArrPattern)) { MustBeGenerated = true };
            var initializeArrayPattern = new ILCall(
                "System.Runtime.CompilerServices.RuntimeHelpers", "InitializeArray",
                new LoadFromVariable(arg1), new ILExpression(ILCode.Ldtoken, ILExpression.AnyOperand));
            foreach (ILBlock block in method.GetSelfAndChildrenRecursive<ILBlock>()) {
                for (int i = block.Body.Count - 1; i >= 0; i--) {
                    if (!newArrPattern.Match(block.Body[i]))
                        continue;
                    ILExpression newArrInst = ((ILExpression)block.Body[i]).Arguments[0];
                    int arrayLength = (int)newArrInst.Arguments[0].Operand;
                    if (arrayLength == 0)
                        continue;
                    if (arg1.Match(block.Body.ElementAtOrDefault(i + 1)) && arg2.Match(block.Body.ElementAtOrDefault(i + 2))) {
                        if (initializeArrayPattern.Match(block.Body.ElementAtOrDefault(i + 3))) {
                            if (HandleStaticallyInitializedArray(arg2, block, i, newArrInst, arrayLength)) {
                                i -= ILInlining.InlineInto(block, i + 1, method) - 1;
                            }
                            continue;
                        }
                    }
                    if (i + 1 + arrayLength > block.Body.Count)
                        continue;
                    List<ILExpression> operands = new List<ILExpression>();
                    for (int j = 0; j < arrayLength; j++) {
                        ILExpression expr = block.Body[i + 1 + j] as ILExpression;
                        if (expr == null || !IsStoreToArray(expr.Code))
                            break;
                        if (!(expr.Arguments[0].Code == ILCode.Ldloc && expr.Arguments[0].Operand == newArrPattern.LastVariable))
                            break;
                        if (!(expr.Arguments[1].Code == ILCode.Ldc_I4 && (int)expr.Arguments[1].Operand == j))
                            break;
                        operands.Add(expr.Arguments[2]);
                    }
                    if (operands.Count == arrayLength) {
                        ((ILExpression)block.Body[i]).Arguments[0] = new ILExpression(
                            ILCode.InitArray, newArrInst.Operand, operands.ToArray());
                        block.Body.RemoveRange(i + 1, arrayLength);
                        i -= ILInlining.InlineInto(block, i + 1, method) - 1;
                    }
                }
            }
        }
开发者ID:richardschneider,项目名称:ILSpy,代码行数:55,代码来源:ArrayInitializers.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ILExpression类代码示例发布时间:2022-05-24
下一篇:
C# ILArray类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap