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


C# CSharp.EntityDeclaration类代码示例

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


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

示例1: AdjustVisibilityForClassesInterfacesAndStructs

        protected static ModelV2.Visibility AdjustVisibilityForClassesInterfacesAndStructs(EntityDeclaration ed)
        {
            VisibilityMode mode = VisibilityMapper.Map(ed.Modifiers);
            mode = mode == [email protected] ? [email protected] : [email protected];

            return new ModelV2.Visibility(mode);
        }
开发者ID:goncalod,项目名称:csharp,代码行数:7,代码来源:NRefactoryVisitorV2Helper.cs

示例2: AppendAttributes

 /// <summary>
 /// Appends node attributes.
 /// </summary>
 /// <param name="buffer">the buffer</param>
 /// <param name="node">the node</param>
 /// <param name="stack">the stack</param>
 /// <example>
 /// <code>
 ///     [XmlIgnore]
 ///     [ConditionalAttribute("CODE_ANALYSIS")]
 ///     int DoSomething();
 /// </code>
 /// </example>
 public static void AppendAttributes(StringBuilder buffer, EntityDeclaration node, int stack)
 {
     foreach (var attribute in node.Attributes)
     {
         buffer.AppendLine(attribute.ToString().Trim(), stack);
     }
 }
开发者ID:kenyamat,项目名称:ICGenerator,代码行数:20,代码来源:AppenderBase.cs

示例3: CheckBody

		static bool CheckBody(EntityDeclaration node)
		{
			var custom = node as CustomEventDeclaration;
			if (custom != null && !(IsValidBody (custom.AddAccessor.Body) || IsValidBody (custom.RemoveAccessor.Body)))
			    return false;
			if (node is PropertyDeclaration || node is IndexerDeclaration) {
				var setter = node.GetChildByRole(PropertyDeclaration.SetterRole);
				var getter = node.GetChildByRole(PropertyDeclaration.GetterRole);
				return IsValidBody(setter.Body) && IsValidBody(getter.Body);
			} 
			return IsValidBody(node.GetChildByRole(Roles.Body));
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:12,代码来源:AbstractAndVirtualConversionAction.cs

示例4: IsObsolete

		static bool IsObsolete (EntityDeclaration entity)
		{
			if (entity == null)
				return false;
			foreach (var section in entity.Attributes) {
				foreach (var attr in section.Attributes) {
					var attrText = attr.Type.GetText ();
					if (attrText == "Obsolete" || attrText == "ObsoleteAttribute" || attrText == "System.Obsolete" || attrText == "System.ObsoleteAttribute" )
						return true;
				}
			}
			return false;
		}
开发者ID:Osbourne,项目名称:monodevelop,代码行数:13,代码来源:AstAmbience.cs

示例5: ImplementStub

		static ThrowStatement ImplementStub (RefactoringContext context, EntityDeclaration newNode)
		{
			ThrowStatement throwStatement = null;
			if (newNode is PropertyDeclaration || newNode is IndexerDeclaration) {
				var setter = newNode.GetChildByRole(PropertyDeclaration.SetterRole);
				if (!setter.IsNull)
					setter.AddChild(CreateNotImplementedBody(context, out throwStatement), Roles.Body); 

				var getter = newNode.GetChildByRole(PropertyDeclaration.GetterRole);
				if (!getter.IsNull)
					getter.AddChild(CreateNotImplementedBody(context, out throwStatement), Roles.Body); 
			} else {
				newNode.AddChild(CreateNotImplementedBody(context, out throwStatement), Roles.Body); 
			}
			return throwStatement;
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:16,代码来源:AbstractAndVirtualConversionAction.cs

示例6: TryGetAttribute

        protected virtual bool TryGetAttribute(EntityDeclaration type, string attributeName, out NRAttribute attribute)
        {
            foreach (var i in type.Attributes)
            {
                foreach (var j in i.Attributes)
                {
                    if (j.Type.ToString() == attributeName)
                    {
                        attribute = j;
                        return true;
                    }

                    // FIXME: Will not try to get the attribute via Resolver.ResolveNode() (see above): it returns a
                    //        different type, without minimum information needed to make a full NRAttribute -fzm
                }
            }

            attribute = default(NRAttribute);
            return false;
        }
开发者ID:yindongfei,项目名称:bridge.lua,代码行数:20,代码来源:Inspector.cs

示例7: HasAttribute

        protected virtual bool HasAttribute(EntityDeclaration type, string name)
        {
            foreach (var i in type.Attributes)
            {
                foreach (var j in i.Attributes)
                {
                    if (j.Type.ToString() == name)
                    {
                        return true;
                    }

                    var resolveResult = this.Resolver.ResolveNode(j, null);
                    if (resolveResult != null && resolveResult.Type != null && resolveResult.Type.FullName == (name + "Attribute"))
                    {
                        return true;
                    }
                }
            }

            return false;
        }
开发者ID:yindongfei,项目名称:bridge.lua,代码行数:21,代码来源:Inspector.cs

示例8: FixAttributesAndDocComment

 void FixAttributesAndDocComment(EntityDeclaration entity)
 {
     var node = entity.FirstChild;
     while (node != null && node.Role == Roles.Comment) {
         node = node.GetNextSibling(NoWhitespacePredicate);
         FixIndentation(node);
     }
     if (entity.Attributes.Count > 0) {
         AstNode n = null;
         foreach (var attr in entity.Attributes.Skip (1)) {
             FixIndentation(attr);
             n = attr;
         }
         if (n != null) {
             FixIndentation(n.GetNextNode(NoWhitespacePredicate));
         } else {
             FixIndentation(entity.Attributes.First().GetNextNode(NoWhitespacePredicate));
         }
     }
 }
开发者ID:JoostK,项目名称:NRefactory,代码行数:20,代码来源:FormattingVisitor_Global.cs

示例9: GetCorrectFileName

		internal static string GetCorrectFileName (MDRefactoringContext context, EntityDeclaration type)
		{
			if (type == null)
				return context.Document.FileName;
			return Path.Combine (Path.GetDirectoryName (context.Document.FileName), type.Name + Path.GetExtension (context.Document.FileName));
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:6,代码来源:MoveTypeToFile.cs

示例10: MaybeCompileAndAddMethodToType

 private void MaybeCompileAndAddMethodToType(JsClass jsClass, EntityDeclaration node, BlockStatement body, IMethod method, MethodScriptSemantics options)
 {
     if (options.GenerateCode) {
         var typeParamNames = options.IgnoreGenericArguments ? (IEnumerable<string>)new string[0] : method.TypeParameters.Select(tp => _namer.GetTypeParameterName(tp)).ToList();
         JsMethod jsMethod;
         if (method.IsAbstract) {
             jsMethod = new JsMethod(method, options.Name, typeParamNames, null);
         }
         else {
             var compiled = CompileMethod(node, body, method, options);
             jsMethod = new JsMethod(method, options.Name, typeParamNames, compiled);
         }
         AddCompiledMethodToType(jsClass, method, options, jsMethod);
     }
 }
开发者ID:jack128,项目名称:SaltarelleCompiler,代码行数:15,代码来源:Compiler.cs

示例11: HasScript

 protected virtual bool HasScript(EntityDeclaration declaration)
 {
     return this.HasAttribute(declaration, Translator.Bridge_ASSEMBLY + ".Script");
 }
开发者ID:yindongfei,项目名称:bridge.lua,代码行数:4,代码来源:Inspector.cs

示例12: AddMethod

        private void AddMethod(bool ctor, EntityDeclaration methodDeclaration, AstNodeCollection<ParameterDeclaration> parameters)
        {
            CLRType t = m_clrTypes.Value.Last.Value;

            List<KeyValuePair<string, string>> args = parameters.Select(p =>
                                                        new KeyValuePair<string, string>(p.Name, p.Type.ToString())
                                                      )
                                                      .ToList();

            Method m = new Method(
                CheckFlag(methodDeclaration.Modifiers, Modifiers.Override),
                ctor,
                CheckFlag(methodDeclaration.Modifiers, Modifiers.Static),
                new Visibility(VisibilityMapper.Map(methodDeclaration.Modifiers)),
                CheckFlag(methodDeclaration.Modifiers, Modifiers.Virtual),
                methodDeclaration.Name,
                CheckFlag(methodDeclaration.Modifiers, Modifiers.Abstract),
                args,
                methodDeclaration.ReturnType.ToString()

            );

            t.Methods.Add(m);   // connect
        }
开发者ID:goncalod,项目名称:csharp,代码行数:24,代码来源:NRefactoryVisitor.cs

示例13: GetInline

        public virtual string GetInline(EntityDeclaration method)
        {
            var attr = this.GetAttribute(method.Attributes, Bridge.Translator.Translator.Bridge_ASSEMBLY + ".Template");

            return attr != null && attr.Arguments.Count > 0 ? ((string)((PrimitiveExpression)attr.Arguments.First()).Value) : null;
        }
开发者ID:Cestbienmoi,项目名称:Bridge,代码行数:6,代码来源:Emitter.Helpers.cs

示例14: ConvertMember

		string ConvertMember(EntityDeclaration entity)
		{
			return ConvertHelper(entity, (p,obj,w,opt) => p.GenerateCodeFromMember((CodeTypeMember)obj, w, opt));
		}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:4,代码来源:CodeDomConvertVisitorTests.cs

示例15: MatchAttributesAndModifiers

 protected bool MatchAttributesAndModifiers(EntityDeclaration o, PatternMatching.Match match)
 {
     return (this.Modifiers == Modifiers.Any || this.Modifiers == o.Modifiers) && this.Attributes.DoMatch (o.Attributes, match);
 }
开发者ID:CSRedRat,项目名称:NRefactory,代码行数:4,代码来源:EntityDeclaration.cs


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