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


C# Ast.TypeDefinition类代码示例

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


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

示例1: LiftGenericTypeDefinition

		private static TypeReference LiftGenericTypeDefinition(TypeDefinition node)
		{
			var typeRef = new GenericTypeReference(node.LexicalInfo, node.QualifiedName);
			foreach (GenericParameterDeclaration parameter in node.GenericParameters)
				typeRef.GenericArguments.Add(Lift(parameter.Name));
			return typeRef;
		}
开发者ID:HaKDMoDz,项目名称:GNet,代码行数:7,代码来源:TypeReference.cs

示例2: LeaveTypeDefinition

		void LeaveTypeDefinition(TypeDefinition node)
		{
			if (!node.IsVisibilitySet)
				node.Modifiers |= Context.Parameters.DefaultTypeVisibility;

			node.Name = NormalizeName(node.Name);
		}
开发者ID:Rfvgyhn,项目名称:boo,代码行数:7,代码来源:NormalizeTypeAndMemberDefinitions.cs

示例3: OnCandidatePartialDefinition

		private void OnCandidatePartialDefinition(TypeDefinition node)
		{
			if (!node.IsPartial)
				return;

			var typeName = node.FullName;

			TypeDefinition originalDefinition;
			if (_partials.TryGetValue(typeName, out originalDefinition))
			{
				if (node == originalDefinition) // MergePartialTypes can be executed more than once
					return;

				if (originalDefinition.NodeType != node.NodeType)
				{
					Errors.Add(CompilerErrorFactory.IncompatiblePartialDefinition(node, typeName, AstUtil.TypeKeywordFor(originalDefinition), AstUtil.TypeKeywordFor(node)));
					return;
				}

				MergeImports(node, originalDefinition);
				originalDefinition.Merge(node);
				RemoveCurrentNode();
			}
			else
				_partials[typeName] = node;
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:26,代码来源:MergePartialTypes.cs

示例4: BuildUniqueTypeMemberName

        //use this to build a type member name unique in the inheritance hierarchy.
        public static string BuildUniqueTypeMemberName(TypeDefinition type, string name)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentNullException("name");

            StringBuilder nameBuilder = new StringBuilder("$");
            nameBuilder.Append(name);
            nameBuilder.Append("__");
            nameBuilder.Append(type.QualifiedName);
            if (type.HasGenericParameters)
            {
                nameBuilder.Append("_");
                string[] parameterNames = Array.ConvertAll<GenericParameterDeclaration, string>(
                    type.GenericParameters.ToArray(),
                    delegate(GenericParameterDeclaration gpd) { return gpd.Name; });
                foreach (string parameterName in parameterNames)
                {
                    nameBuilder.Append("_");
                    nameBuilder.Append(parameterName);
                }
            }
            nameBuilder.Replace('.', '_');
            nameBuilder.Append("$");
            return nameBuilder.ToString();
        }
开发者ID:boo,项目名称:boo-lang,代码行数:26,代码来源:AstUtil.cs

示例5: EnterTypeDefinition

		void EnterTypeDefinition(TypeDefinition node)
		{
			List<Field> list = new List<Field>();
			fieldStack.Push(list);
			foreach (TypeMember member in node.Members) {
				if (member is Field)
					list.Add((Field)member);
			}
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:9,代码来源:RemoveRedundantTypeReferencesVisitor.cs

示例6: BindMembers

        public static void BindMembers(string cacheName,TypeDefinition type){
            if (!cache.ContainsKey(cacheName)) return;
            foreach (var member in cache[cacheName]){ 
                type.Members.Add(member);
            }
            cache.Remove(cacheName);

            new Method().Parameters.Add(new ParameterDeclaration("name",new SimpleTypeReference("string")));
        }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:9,代码来源:MacroCache.cs

示例7: OnTypeDefinition

		private void OnTypeDefinition(TypeDefinition node)
		{
			var old = _currentType;
			_currentType = (IType)node.Entity;
			Visit(node.Attributes);
			Visit(node.BaseTypes);
			Visit(node.Members);
			Visit(node.GenericParameters);
			_currentType = old;
		}
开发者ID:Rfvgyhn,项目名称:boo,代码行数:10,代码来源:DetectInnerGenerics.cs

示例8: InternalGenericParameter

        public InternalGenericParameter(TypeSystemServices tss, GenericParameterDeclaration declaration)
        {
            _tss = tss;
            _declaration = declaration;

            // Determine and remember declaring type and declaring method (if applicable)
            _declaringMethod = declaration.ParentNode as Method;
            _declaringType = (
                _declaringMethod == null ?
                declaration.ParentNode as TypeDefinition : _declaringMethod.DeclaringType);
        }
开发者ID:w4x,项目名称:boolangstudio,代码行数:11,代码来源:InternalGenericParameter.cs

示例9: ExtendBaseClass

 protected override void ExtendBaseClass(TypeDefinition definition)
 {
     Property property = new Property("Environment");
     property.Getter = new Method("getter_Environment");
     property.Getter.Body.Add(
         new ReturnStatement(
             new StringLiteralExpression(environment ?? "")
             )
         );
     definition.Members.Add(property);
 }
开发者ID:janlimpens,项目名称:rhino-commons,代码行数:11,代码来源:BinsorCompilerStep.cs

示例10: CheckMembers

		void CheckMembers(TypeDefinition node)
		{
			_members.Clear();
			
			foreach (TypeMember member in node.Members)
			{
				if (member.NodeType == NodeType.StatementTypeMember)
					continue;

				var list = GetMemberList(member.Name);
				CheckMember(list, member);
				list.Add(member);
			}
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:14,代码来源:CheckMemberNames.cs

示例11: MergeImports

        static void MergeImports(TypeDefinition from, TypeDefinition to)
        {
            Module fromModule = from.EnclosingModule;
            Module toModule = to.EnclosingModule;
            if (fromModule == toModule) return;
            if (toModule.ContainsAnnotation(fromModule)) return;

            toModule.Imports.ExtendWithClones(fromModule.Imports.Where(i => !toModule.Imports.Any(i2 => i.Matches(i2))));
            // annotate so we remember not to merge the imports
            // again in the future
            toModule.Annotate(fromModule);

            //annotate so that we know these modules have been merged
            //this is used by checkneverusedmembers step
            if (!fromModule.ContainsAnnotation("merged-module"))
                fromModule.Annotate("merged-module");
            if (!toModule.ContainsAnnotation("merged-module"))
                toModule.Annotate("merged-module");
        }
开发者ID:boo-lang,项目名称:boo,代码行数:19,代码来源:MergePartialTypes.cs

示例12: LeaveTypeDefinition

		override public void LeaveTypeDefinition(TypeDefinition node)
		{
			_safeVars.Clear(); //clear type var cache (CheckAmbiguousVariableNames)

			if (node.NodeType == NodeType.Module)
				return;

			string qualifiedName = node.QualifiedName;
			if (node.HasGenericParameters)
			{
				qualifiedName += "`" + node.GenericParameters.Count;
			}

			if (_types.ContainsKey(qualifiedName))
			{
				Errors.Add(CompilerErrorFactory.NamespaceAlreadyContainsMember(node, GetNamespace(node), node.Name));
				return;
			}
			_types.Add(qualifiedName, node); 
		}
开发者ID:Rfvgyhn,项目名称:boo,代码行数:20,代码来源:StricterErrorChecking.cs

示例13: BaseTypeResolution

		public BaseTypeResolution(CompilerContext context, TypeDefinition typeDefinition, List<TypeDefinition> visited) : base(context)
		{
			_typeDefinition = typeDefinition;
			_visited = visited;
			_visited.Add(_typeDefinition);

			_removed = 0;
			_index = -1;

			NameResolutionService nameResolution = NameResolutionService;
			INamespace previous = nameResolution.CurrentNamespace;
			nameResolution.EnterNamespace(ParentNamespaceOf(_typeDefinition));
			try
			{
				Run();
			}
			finally
			{
				nameResolution.EnterNamespace(previous);
			}
		}
开发者ID:HaKDMoDz,项目名称:GNet,代码行数:21,代码来源:BaseTypeResolution.cs

示例14: GenerateConstructors

		private void GenerateConstructors(TypeDefinition definition)
		{
			ConstructorInfo[] ctors =
				baseClass.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
			foreach (ConstructorInfo ctor in ctors)
			{
				if (ctor.IsPrivate)
					continue;
				Constructor constructor = new Constructor(definition.LexicalInfo);
				definition.Members.Add(constructor);
				MethodInvocationExpression super = new MethodInvocationExpression(new SuperLiteralExpression());
				constructor.Body.Add(super);
				foreach (ParameterInfo info in ctor.GetParameters())
				{
					SimpleTypeReference typeReference =
						new SimpleTypeReference(TypeUtilities.GetFullName(info.ParameterType));
					constructor.Parameters.Add(new ParameterDeclaration(info.Name,
																		typeReference)
						);
					super.Arguments.Add(new ReferenceExpression(info.Name));
				}
			}
		}
开发者ID:yonglehou,项目名称:NGinnBPM,代码行数:23,代码来源:BaseClassCompilerStep.cs

示例15: GetStaticConstructor

 Constructor GetStaticConstructor(TypeDefinition type)
 {
     return CodeBuilder.GetOrCreateStaticConstructorFor(type);
 }
开发者ID:stuman08,项目名称:boo,代码行数:4,代码来源:ProcessMethodBodies.cs


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