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


C# TypeSystem.InternalMethod类代码示例

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


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

示例1: CreateClosureClass

		BooClassBuilder CreateClosureClass(ForeignReferenceCollector collector, InternalMethod closure)
		{
			Method method = closure.Method;
			TypeDefinition parent = method.DeclaringType;
			parent.Members.Remove(method);
			
			BooClassBuilder builder = collector.CreateSkeletonClass(closure.Name, method.LexicalInfo);
			parent.Members.Add(builder.ClassDefinition);
			builder.ClassDefinition.Members.Add(method);
			method.Name = "Invoke";
			
			if (method.IsStatic)
			{
				// need to adjust paremeter indexes (parameter 0 is now self)
				foreach (ParameterDeclaration parameter in method.Parameters)
				{
					((InternalParameter)parameter.Entity).Index += 1;
				}
			}
			
			method.Modifiers = TypeMemberModifiers.Public;
			var coll = new GenericTypeCollector(CodeBuilder);
			coll.Process(builder.ClassDefinition);
			return builder;
		}
开发者ID:Rfvgyhn,项目名称:boo,代码行数:25,代码来源:ProcessClosures.cs

示例2: InferGeneratorItemTypeFor

		IType InferGeneratorItemTypeFor(InternalMethod generator)
		{
			if (TypeSystemServices.IsGenericGeneratorReturnType(generator.ReturnType))
				return generator.ReturnType.ConstructedInfo.GenericArguments[0];

			var yieldExpressions = generator.YieldExpressions;
			return yieldExpressions.Count > 0
				? TypeSystemServices.GetMostGenericType(yieldExpressions)
				: TypeSystemServices.ObjectType;
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:10,代码来源:GeneratorItemTypeInferrer.cs

示例3: GeneratorMethodProcessor

 public GeneratorMethodProcessor(CompilerContext context, InternalMethod method)
 {
     _labels = new List();
     _mapping = new Hashtable();
     _generator = method;
     _generatorItemType = (IType)_generator.Method["GeneratorItemType"];
     _enumerable = (BooClassBuilder)_generator.Method["GeneratorClassBuilder"];
     Debug.Assert(null != _generatorItemType);
     Debug.Assert(null != _enumerable);
     Initialize(context);
 }
开发者ID:boo,项目名称:boo-lang,代码行数:11,代码来源:GeneratorMethodProcessor.cs

示例4: Initialize

		public override void Initialize(CompilerContext context)
		{
			base.Initialize(context);

			_currentModule = null;
			_currentMethod = null;
			_methodStack = new Stack<InternalMethod>();
			_memberStack = new Stack();
			_callableResolutionService = new EnvironmentProvision<CallableResolutionService>();
			_invocationTypeReferenceRules = new EnvironmentProvision<InvocationTypeInferenceRules>();
			_typeChecker = new EnvironmentProvision<TypeChecker>();
			_methodCache = new EnvironmentProvision<RuntimeMethodCache>();
		}
开发者ID:Rfvgyhn,项目名称:boo,代码行数:13,代码来源:ProcessMethodBodies.cs

示例5: GeneratorMethodProcessor

		public GeneratorMethodProcessor(CompilerContext context, InternalMethod method)
		{
			_labels = new List<LabelStatement>();
			_mapping = new Hashtable();
			_generator = method;

			var skeleton = My<GeneratorSkeletonBuilder>.Instance.SkeletonFor(method);
			_generatorItemType = skeleton.GeneratorItemType;
			_enumerable = skeleton.GeneratorClassBuilder;
			_getEnumeratorBuilder = skeleton.GetEnumeratorBuilder;

			Initialize(context);
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:13,代码来源:GeneratorMethodProcessor.cs

示例6: GeneratorMethodProcessor

        public GeneratorMethodProcessor(CompilerContext context, InternalMethod method)
        {
            _labels = new List();
            _mapping = new Hashtable();
            _generator = method;

            GeneratorSkeleton skeleton = context.Provide<GeneratorSkeletonBuilder>().SkeletonFor(method);
            _generatorItemType = skeleton.GeneratorItemType;
            _enumerable = skeleton.GeneratorClassBuilder;
            _getEnumeratorBuilder = skeleton.GetEnumeratorBuilder;

            Initialize(context);
        }
开发者ID:Bombadil77,项目名称:boo,代码行数:13,代码来源:GeneratorMethodProcessor.cs

示例7: TryToResolveReturnType

        void TryToResolveReturnType(InternalMethod entity)
        {
            if (entity.IsGenerator)
            {
                ResolveGeneratorReturnType(entity);
                return;
            }

            if (CanResolveReturnType(entity))
                ResolveReturnType(entity);
        }
开发者ID:stuman08,项目名称:boo,代码行数:11,代码来源:ProcessMethodBodies.cs

示例8: ResolveReturnType

 void ResolveReturnType(InternalMethod entity)
 {
     var method = entity.Method;
     method.ReturnType = entity.ReturnExpressions == null
         ? CodeBuilder.CreateTypeReference(TypeSystemServices.VoidType)
         : GetMostGenericTypeReference(entity.ReturnExpressions);
     TraceReturnType(method, entity);
 }
开发者ID:stuman08,项目名称:boo,代码行数:8,代码来源:ProcessMethodBodies.cs

示例9: ResolveGeneratorReturnType

 void ResolveGeneratorReturnType(InternalMethod entity)
 {
     IType returnType = GetGeneratorReturnType(entity);
     entity.Method.ReturnType = CodeBuilder.CreateTypeReference(returnType);
 }
开发者ID:stuman08,项目名称:boo,代码行数:5,代码来源:ProcessMethodBodies.cs

示例10: ProcessNodeInMethodContext

 void ProcessNodeInMethodContext(InternalMethod entity, INamespace ns, Node node)
 {
     PushMethodInfo(entity);
     EnterNamespace(ns);
     try
     {
         Visit(node);
     }
     finally
     {
         LeaveNamespace();
         PopMethodInfo();
     }
 }
开发者ID:stuman08,项目名称:boo,代码行数:14,代码来源:ProcessMethodBodies.cs

示例11: ProcessMethodBody

 void ProcessMethodBody(InternalMethod entity, INamespace ns)
 {
     ProcessNodeInMethodContext(entity, ns, entity.Method.Body);
 }
开发者ID:stuman08,项目名称:boo,代码行数:4,代码来源:ProcessMethodBodies.cs

示例12: CanResolveReturnType

 static bool CanResolveReturnType(InternalMethod method)
 {
     var expressions = method.ReturnExpressions;
     if (null != expressions)
     {
         foreach (var expression in expressions)
         {
             IType type = expression.ExpressionType;
             if (type == null || TypeSystemServices.IsUnknown(type))
                 return false;
         }
     }
     return true;
 }
开发者ID:stuman08,项目名称:boo,代码行数:14,代码来源:ProcessMethodBodies.cs

示例13: GetGeneratorReturnType

        /// <summary>
        /// Allows a different language to use custom rules for generator
        /// return types.
        /// </summary>
        /// <param name="generator"></param>
        /// <returns></returns>
        protected virtual IType GetGeneratorReturnType(InternalMethod generator)
        {
            // Make method return a generic IEnumerable
            IType itemType = GeneratorItemTypeFor(generator);
            if (TypeSystemServices.VoidType == itemType)
                // circunvent exception in MakeGenericType
                return TypeSystemServices.ErrorEntity;

            IType enumerableType = TypeSystemServices.IEnumerableGenericType;
            return enumerableType.GenericInfo.ConstructType(itemType);
        }
开发者ID:stuman08,项目名称:boo,代码行数:17,代码来源:ProcessMethodBodies.cs

示例14: GetMostSimilarBaseMethodName

 private string GetMostSimilarBaseMethodName(InternalMethod entity)
 {
     return NameResolutionService.GetMostSimilarMemberName(entity.DeclaringType.BaseType, entity.Name, EntityType.Method);
 }
开发者ID:stuman08,项目名称:boo,代码行数:4,代码来源:ProcessMethodBodies.cs

示例15: MethodHidesInheritedNonVirtual

 private void MethodHidesInheritedNonVirtual(InternalMethod hidingMethod, IMethod hiddenMethod)
 {
     Warnings.Add(CompilerWarningFactory.MethodHidesInheritedNonVirtual(hidingMethod.Method, hidingMethod, hiddenMethod));
 }
开发者ID:stuman08,项目名称:boo,代码行数:4,代码来源:ProcessMethodBodies.cs


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