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

C# TypeSystem.InternalMethod类代码示例

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

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



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


示例16: FindMethodOverridenBy

        private static IMethod FindMethodOverridenBy(InternalMethod entity, IEntity candidates)
        {
            if (EntityType.Method == candidates.EntityType)
            {
                var candidate = (IMethod)candidates;
                if (TypeSystemServices.CheckOverrideSignature(entity, candidate))
                    return candidate;
            }

            if (EntityType.Ambiguous == candidates.EntityType)
                foreach (IMethod candidate in ((Ambiguous) candidates).Entities)
                    if (TypeSystemServices.CheckOverrideSignature(entity, candidate))
                        return candidate;

            return null;
        }
开发者ID:stuman08,项目名称:boo,代码行数:16,代码来源:ProcessMethodBodies.cs


示例17: AddInitializerToStaticConstructor

 void AddInitializerToStaticConstructor(TypeDefinition type, InternalMethod initializer)
 {
     GetStaticConstructor(type).Body.Insert(0,
                                            CodeBuilder.CreateMethodInvocation(initializer));
 }
开发者ID:stuman08,项目名称:boo,代码行数:5,代码来源:ProcessMethodBodies.cs


示例18: ProcessMethodOverride

        void ProcessMethodOverride(InternalMethod entity, IMethod baseMethod)
        {
            CallableSignature baseSignature = TypeSystemServices.GetOverriddenSignature(baseMethod, entity);

            if (TypeSystemServices.IsUnknown(entity.ReturnType))
            {
                entity.Method.ReturnType = CodeBuilder.CreateTypeReference(entity.Method.LexicalInfo, baseSignature.ReturnType);
            }
            else if (baseSignature.ReturnType != entity.ReturnType)
            {
                Error(CompilerErrorFactory.InvalidOverrideReturnType(
                    entity.Method.ReturnType,
                    baseMethod,
                    baseMethod.ReturnType,
                    entity.ReturnType));
            }
            SetOverride(entity, baseMethod);
        }
开发者ID:stuman08,项目名称:boo,代码行数:18,代码来源:ProcessMethodBodies.cs


示例19: CheckGeneratorCantReturnValues

        void CheckGeneratorCantReturnValues(InternalMethod entity)
        {
            if (!entity.IsGenerator) return;
            if (null == entity.ReturnExpressions) return;

            foreach (Expression e in entity.ReturnExpressions)
            {
                Error(CompilerErrorFactory.GeneratorCantReturnValue(e));
            }
        }
开发者ID:stuman08,项目名称:boo,代码行数:10,代码来源:ProcessMethodBodies.cs


示例20: PushMethodInfo

        void PushMethodInfo(InternalMethod entity)
        {
            _methodStack.Push(_currentMethod);

            _currentMethod = entity;
        }
开发者ID:stuman08,项目名称:boo,代码行数:6,代码来源:ProcessMethodBodies.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# BookSleeve.RedisConnection类代码示例发布时间:2022-05-24
下一篇:
C# TypeSystem.Ambiguous类代码示例发布时间: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