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


C# IMethodData类代码示例

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


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

示例1: Iterator

 //
 // Our constructor
 //
 public Iterator(ParametersBlock block, IMethodData method, TypeContainer host, TypeSpec iterator_type, bool is_enumerable)
     : base(block, TypeManager.bool_type, block.StartLocation)
 {
     this.OriginalMethod = method;
     this.OriginalIteratorType = iterator_type;
     this.IsEnumerable = is_enumerable;
     this.Host = host;
     this.type = method.ReturnType;
 }
开发者ID:RainsSoft,项目名称:MonoCompilerAsAService,代码行数:12,代码来源:iterators.cs

示例2: MethodDiff

        public MethodDiff(IMethodData oldField, IMethodData newField)
        {
            AddedAttributes = new List<IAttributeData>();
            RemovedAttributes = new List<IAttributeData>();

            if (oldField.MethodSignature != newField.MethodSignature)
            {
                throw new NtegrityException("Attempted to diff two different Enums!");
            }
            MethodSignature = oldField.MethodSignature;

            GetAddedAndRemovedAttributes(oldField, newField);
        }
开发者ID:JessieArr,项目名称:Ntegrity,代码行数:13,代码来源:MethodDiff.cs

示例3: Iterator

        //
        // Our constructor
        //
        private Iterator(CompilerContext ctx, IMethodData method, TypeContainer host, TypeSpec iterator_type, bool is_enumerable)
            : base(new ToplevelBlock (ctx, method.Block, ParametersCompiled.EmptyReadOnlyParameters, method.Block.StartLocation),
				TypeManager.bool_type,
				method.Location)
        {
            this.OriginalMethod = method;
            this.OriginalIteratorType = iterator_type;
            this.IsEnumerable = is_enumerable;
            this.Host = host;
            this.type = method.ReturnType;

            IteratorHost = Block.ChangeToIterator (this, method.Block);
        }
开发者ID:speier,项目名称:shake,代码行数:16,代码来源:iterators.cs

示例4: MethodData

		public MethodData (InterfaceMemberBase member,
				   Modifiers modifiers, MethodAttributes flags, 
				   IMethodData method,
				   MethodSpec parent_method)
			: this (member, modifiers, flags, method)
		{
			this.parent_method = parent_method;
		}
开发者ID:OpenFlex,项目名称:playscript-mono,代码行数:8,代码来源:method.cs

示例5: MethodData

		public MethodData (InterfaceMemberBase member,
				   Modifiers modifiers, MethodAttributes flags, 
				   IMethodData method, MethodBuilder builder,
				   GenericMethod generic, MethodSpec parent_method)
			: this (member, modifiers, flags, method)
		{
			this.builder = builder;
			this.GenericMethod = generic;
			this.parent_method = parent_method;
		}
开发者ID:spencerhakim,项目名称:mono,代码行数:10,代码来源:method.cs

示例6: CreateIterator

        public static void CreateIterator(IMethodData method, TypeContainer parent, Modifiers modifiers, CompilerContext ctx)
        {
            bool is_enumerable;
            TypeSpec iterator_type;

            TypeSpec ret = method.ReturnType;
            if (ret == null)
                return;

            if (!CheckType (ret, out iterator_type, out is_enumerable)) {
                ctx.Report.Error (1624, method.Location,
                          "The body of `{0}' cannot be an iterator block " +
                          "because `{1}' is not an iterator interface type",
                          method.GetSignatureForError (),
                          TypeManager.CSharpName (ret));
                return;
            }

            ParametersCompiled parameters = method.ParameterInfo;
            for (int i = 0; i < parameters.Count; i++) {
                Parameter p = parameters [i];
                Parameter.Modifier mod = p.ModFlags;
                if ((mod & Parameter.Modifier.ISBYREF) != 0) {
                    ctx.Report.Error (1623, p.Location,
                        "Iterators cannot have ref or out parameters");
                    return;
                }

                if (p is ArglistParameter) {
                    ctx.Report.Error (1636, method.Location,
                        "__arglist is not allowed in parameter list of iterators");
                    return;
                }

                if (parameters.Types [i].IsPointer) {
                    ctx.Report.Error (1637, p.Location,
                              "Iterators cannot have unsafe parameters or " +
                              "yield types");
                    return;
                }
            }

            if ((modifiers & Modifiers.UNSAFE) != 0) {
                ctx.Report.Error (1629, method.Location, "Unsafe code may not appear in iterators");
                return;
            }

            // TODO: Ugly leftover
            new Iterator (ctx, method, parent, iterator_type, is_enumerable);
        }
开发者ID:speier,项目名称:shake,代码行数:50,代码来源:iterators.cs

示例7: Resolve

		public bool Resolve (FlowBranching parent, BlockContext rc, IMethodData md)
		{
			if (resolved)
				return true;

			resolved = true;

			if (rc.HasSet (ResolveContext.Options.ExpressionTreeConversion))
				flags |= Flags.IsExpressionTree;

			try {
				ResolveMeta (rc);

				using (rc.With (ResolveContext.Options.DoFlowAnalysis, true)) {
					FlowBranchingToplevel top_level = rc.StartFlowBranching (this, parent);

					if (!Resolve (rc))
						return false;

					unreachable = top_level.End ();
				}
			} catch (Exception e) {
				if (e is CompletionResult || rc.Report.IsDisabled)
					throw;

				if (rc.CurrentBlock != null) {
					rc.Report.Error (584, rc.CurrentBlock.StartLocation, "Internal compiler error: {0}", e.Message);
				} else {
					rc.Report.Error (587, "Internal compiler error: {0}", e.Message);
				}

				if (Report.DebugFlags > 0)
					throw;
			}

			if (rc.ReturnType != TypeManager.void_type && !unreachable) {
				if (rc.CurrentAnonymousMethod == null) {
					// FIXME: Missing FlowAnalysis for generated iterator MoveNext method
					if (md is IteratorMethod) {
						unreachable = true;
					} else {
						rc.Report.Error (161, md.Location, "`{0}': not all code paths return a value", md.GetSignatureForError ());
						return false;
					}
				} else {
					rc.Report.Error (1643, rc.CurrentAnonymousMethod.Location, "Not all code paths return a value in anonymous method of type `{0}'",
							  rc.CurrentAnonymousMethod.GetSignatureForError ());
					return false;
				}
			}

			return true;
		}
开发者ID:alisci01,项目名称:mono,代码行数:53,代码来源:statement.cs

示例8: WrapIntoIterator

		public void WrapIntoIterator (IMethodData method, TypeContainer host, TypeSpec iterator_type, bool is_enumerable)
		{
			ParametersBlock pb = new ParametersBlock (this, ParametersCompiled.EmptyReadOnlyParameters, StartLocation);
			pb.EndLocation = EndLocation;
			pb.statements = statements;

			var iterator = new Iterator (pb, method, host, iterator_type, is_enumerable);
			am_storey = new IteratorStorey (iterator);

			statements = new List<Statement> (1);
			AddStatement (new Return (iterator, iterator.Location));
		}
开发者ID:alisci01,项目名称:mono,代码行数:12,代码来源:statement.cs

示例9: GetEmptyMethod

 public static List<string> GetEmptyMethod(IMethodData method)
 {
     return new List<string>
                {
                    String.Empty,
                    "public " + method.FullSignature,
                    "{",
                    "    " + GetValidReturnStatement(method.ReturnType),
                    "}"
                };
 }
开发者ID:urise,项目名称:JohanCorner,代码行数:11,代码来源:CodeHelper.cs

示例10: GetAddedAndRemovedAttributes

 private void GetAddedAndRemovedAttributes(IMethodData beforeField, IMethodData afterField)
 {
     foreach (var oldAttribute in beforeField.AttributeData)
     {
         if (afterField.AttributeData.All(x => x.Name != oldAttribute.Name))
         {
             RemovedAttributes.Add(oldAttribute);
             HasChanged = true;
         }
     }
     foreach (var newAttribute in afterField.AttributeData)
     {
         if (beforeField.AttributeData.All(x => x.Name != newAttribute.Name))
         {
             AddedAttributes.Add(newAttribute);
             HasChanged = true;
         }
     }
 }
开发者ID:JessieArr,项目名称:Ntegrity,代码行数:19,代码来源:MethodDiff.cs

示例11: Resolve

		public bool Resolve (FlowBranching parent, BlockContext rc, ParametersCompiled ip, IMethodData md)
		{
			if (resolved)
				return true;

			resolved = true;

			try {
				if (!ResolveMeta (rc, ip))
					return false;

				using (rc.With (ResolveContext.Options.DoFlowAnalysis, true)) {
					FlowBranchingToplevel top_level = rc.StartFlowBranching (this, parent);

					if (!Resolve (rc))
						return false;

					unreachable = top_level.End ();
				}
			} catch (Exception) {
#if PRODUCTION
				if (rc.CurrentBlock != null) {
					ec.Report.Error (584, rc.CurrentBlock.StartLocation, "Internal compiler error: Phase Resolve");
				} else {
					ec.Report.Error (587, "Internal compiler error: Phase Resolve");
				}
#endif
				throw;
			}

			if (rc.ReturnType != TypeManager.void_type && !unreachable) {
				if (rc.CurrentAnonymousMethod == null) {
					rc.Report.Error (161, md.Location, "`{0}': not all code paths return a value", md.GetSignatureForError ());
					return false;
				} else if (!rc.CurrentAnonymousMethod.IsIterator) {
					rc.Report.Error (1643, rc.CurrentAnonymousMethod.Location, "Not all code paths return a value in anonymous method of type `{0}'",
							  rc.CurrentAnonymousMethod.GetSignatureForError ());
					return false;
				}
			}

			return true;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:43,代码来源:statement.cs

示例12: TryInline

		public Expression TryInline(ResolveContext rc) {
			if (!(Expr is Invocation)) {
				return Expr;
			}

			invocation = (Expr as Invocation);
			if (invocation.MethodGroup.BestCandidate == null) {
				return Expr;
			}

			methodSpec = invocation.MethodGroup.BestCandidate;
			if (!(methodSpec.MemberDefinition is MethodCore)) {
				return Expr;
			}

			method = methodSpec.MemberDefinition as MemberCore;
			methodData = method as IMethodData;

			if (methodData.IsInlinable) {
				return Expr;
			}

			TypeSpec returnType = methodData.ReturnType;

			ToplevelBlock block = methodData.Block;
			if (block.Parameters.Count > 0 || block.TopBlock.NamesCount > 0 && block.TopBlock.LabelsCount > 0) {
				return Expr;
			}

			if (returnType != rc.BuiltinTypes.Void && 
			    block.Statements.Count == 1 && block.Statements [0] is Return) {
				inlineExpr = ((Return)block.Statements [0]).Expr.Clone (new CloneContext());
			} else if (returnType == rc.BuiltinTypes.Void) {
				Block newBlock = new Block (rc.CurrentBlock, block.StartLocation, block.EndLocation);
				foreach (var st in block.Statements) {
					newBlock.AddStatement (st.Clone (new CloneContext()));
				}
//				inlineExpr = newBlock;
			}

			this.rc = rc;
			this.inlineFailed = false;

			Expression ret;

			inlineExpr.Accept (this);
			ret = inlineExpr;

			if (inlineFailed) {
				return Expr;
			}

			return ret;
		}
开发者ID:rlfqudxo,项目名称:playscript-mono,代码行数:54,代码来源:inliner.cs

示例13: Iterator

		//
		// Our constructor
		//
		private Iterator (IMethodData method, TypeContainer host, Type iterator_type, bool is_enumerable)
			: base (
				new ToplevelBlock (method.Block, Parameters.EmptyReadOnlyParameters, method.Block.StartLocation),
				TypeManager.bool_type,
				method.Location)
		{
			this.OriginalMethod = method;
			this.OriginalIteratorType = iterator_type;
			this.IsEnumerable = is_enumerable;
			this.Host = host;

			IteratorHost = Block.ChangeToIterator (this, method.Block);
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:16,代码来源:iterators.cs

示例14: ResolveTopBlock

		public bool ResolveTopBlock (EmitContext anonymous_method_host, ToplevelBlock block,
					     Parameters ip, IMethodData md, out bool unreachable)
		{
			if (resolved) {
				unreachable = this.unreachable;
				return true;
			}

			current_phase = Phase.Resolving;
			unreachable = false;

			if (!loc.IsNull)
				CurrentFile = loc.File;

#if PRODUCTION
			try {
#endif
				if (!block.ResolveMeta (this, ip))
					return false;

				using (this.With (EmitContext.Flags.DoFlowAnalysis, true)) {
					FlowBranchingToplevel top_level;
					if (anonymous_method_host != null)
						top_level = new FlowBranchingToplevel (anonymous_method_host.CurrentBranching, block);
					else 
						top_level = block.TopLevelBranching;

					current_flow_branching = top_level;
					bool ok = block.Resolve (this);
					current_flow_branching = null;

					if (!ok)
						return false;

					bool flow_unreachable = top_level.End ();
					if (flow_unreachable)
						this.unreachable = unreachable = true;
				}
#if PRODUCTION
			} catch (Exception e) {
				Console.WriteLine ("Exception caught by the compiler while compiling:");
				Console.WriteLine ("   Block that caused the problem begin at: " + loc);

				if (CurrentBlock != null){
					Console.WriteLine ("                     Block being compiled: [{0},{1}]",
							   CurrentBlock.StartLocation, CurrentBlock.EndLocation);
				}
				Console.WriteLine (e.GetType ().FullName + ": " + e.Message);
				throw;
			}
#endif

			if (return_type != TypeManager.void_type && !unreachable) {
				if (CurrentAnonymousMethod == null) {
					Report.Error (161, md.Location, "`{0}': not all code paths return a value", md.GetSignatureForError ());
					return false;
				} else if (!CurrentAnonymousMethod.IsIterator) {
					Report.Error (1643, CurrentAnonymousMethod.Location, "Not all code paths return a value in anonymous method of type `{0}'",
						      CurrentAnonymousMethod.GetSignatureForError ());
					return false;
				}
			}

			resolved = true;
			return true;
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:66,代码来源:codegen.cs

示例15: EmitTopBlock

		//
		// Here until we can fix the problem with Mono.CSharp.Switch, which
		// currently can not cope with ig == null during resolve (which must
		// be fixed for switch statements to work on anonymous methods).
		//
		public void EmitTopBlock (IMethodData md, ToplevelBlock block)
		{
			if (block == null)
				return;
			
			bool unreachable;
			
			if (ResolveTopBlock (null, block, md.ParameterInfo, md, out unreachable)){
				if (Report.Errors > 0)
					return;

				EmitMeta (block);

				current_phase = Phase.Emitting;
#if PRODUCTION
				try {
#endif
				EmitResolvedTopBlock (block, unreachable);
#if PRODUCTION
				} catch (Exception e){
					Console.WriteLine ("Exception caught by the compiler while emitting:");
					Console.WriteLine ("   Block that caused the problem begin at: " + block.loc);
					
					Console.WriteLine (e.GetType ().FullName + ": " + e.Message);
					throw;
				}
#endif
			}
		}
开发者ID:lewurm,项目名称:benchmarker,代码行数:34,代码来源:codegen.cs


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