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

C# AttributeSection类代码示例

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

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



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

示例1: AddSerializibility

		/// <summary>
		/// Makes sure that the PHP-visible type is serializable.
		/// </summary>
		private void AddSerializibility(TypeDeclaration type, TypeDeclaration outType)
		{
			// make the type serializable
			if (!Utility.IsDecoratedByAttribute(type, "System.SerializableAttribute"))
			{
				AttributeSection section = new AttributeSection();
				section.Attributes.Add(new ICSharpCode.NRefactory.Parser.AST.Attribute("Serializable", null, null));
				outType.Attributes.Add(section);

				ConstructorDeclaration ctor = new ConstructorDeclaration(type.Name, 
					((type.Modifier & Modifier.Sealed) == Modifier.Sealed ? Modifier.Private : Modifier.Protected),
					new List<ParameterDeclarationExpression>(), null);

				ctor.Parameters.Add(
					new ParameterDeclarationExpression(new TypeReference("System.Runtime.Serialization.SerializationInfo"), "info"));
				ctor.Parameters.Add(
					new ParameterDeclarationExpression(new TypeReference("System.Runtime.Serialization.StreamingContext"), "context"));

				ctor.ConstructorInitializer = new ConstructorInitializer();
				ctor.ConstructorInitializer.ConstructorInitializerType = ConstructorInitializerType.Base;
					
				ctor.ConstructorInitializer.Arguments.Add(new IdentifierExpression("info"));
				ctor.ConstructorInitializer.Arguments.Add(new IdentifierExpression("context"));

				ctor.Body = new BlockStatement();

				outType.AddChild(ctor);
			}
		}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:32,代码来源:Dynamizer.cs


示例2: ApplyActionTo

        public override ActionResult ApplyActionTo(StringBuilder sb)
        {
            int startSearch = FieldToAddTo.TextRange.StartOffset;
            string text = sb.ToString();

            // Put the new Attribute just in front of the property declaration.
            int insertionPoint = text.LastIndexOf("\n", startSearch) + 1;

            AttributeSection section = new AttributeSection(AttributeToAdd.Controller);
            section.AddAttribute(AttributeToAdd);
            section.PreceedingBlankLines = -1;
            var indentLevel = InsertionHelpers.GetIndentationInFrontOf(text, startSearch);
            section.Controller.IndentLevel = indentLevel;

            string newText = Helper.StandardizeLineBreaks(section.ToString(), "\n") + "\n";

            // Calculate the Attribute's Text Range
            // The start index is the insertion point + the number of tabs in front of the attribute, +1 for the \n
            AttributeToAdd.TextRange.StartOffset = insertionPoint + indentLevel + 1;
            AttributeToAdd.TextRange.EndOffset = AttributeToAdd.TextRange.StartOffset + (newText.Trim()).Length;

            sb.Insert(insertionPoint, newText);

            FieldToAddTo.AttributeSections.Add(section);

            //return new ActionResult(insertionPoint, newText.Length, new[] { AttributeToAdd });
            return new ActionResult(AttributeToAdd.TextRange.StartOffset, newText.Length, new[] { AttributeToAdd });
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:28,代码来源:AddAttributeToFieldAction.cs


示例3: VisitAttributeSection

		public virtual object VisitAttributeSection(AttributeSection attributeSection, object data) {
			Debug.Assert((attributeSection != null));
			Debug.Assert((attributeSection.Attributes != null));
			foreach (ICSharpCode.NRefactory.Ast.Attribute o in attributeSection.Attributes) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			return null;
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:9,代码来源:AbstractASTVisitor.cs


示例4: VisitAttributeSection

 public override void VisitAttributeSection(AttributeSection attributeSection)
 {
     VisitChildrenToFormat(attributeSection, child => {
         child.AcceptVisitor(this);
         if (child.NextSibling != null && child.NextSibling.Role == Roles.RBracket) {
             ForceSpacesAfter(child, false);
         }
     });
 }
开发者ID:porcus,项目名称:NRefactory,代码行数:9,代码来源:FormattingVisitor_Global.cs


示例5: MakeNonBrowsable

		/// <summary>
		/// Makes the given node [EditorBrowsable(Never)].
		/// </summary>
		public static void MakeNonBrowsable(AttributedNode node)
		{
			AttributeSection section = new AttributeSection();
			ICSharpCode.NRefactory.Parser.AST.Attribute attribute =
				new ICSharpCode.NRefactory.Parser.AST.Attribute("System.ComponentModel.EditorBrowsable",
				new List<Expression>(), null);

			attribute.PositionalArguments.Add(new FieldReferenceExpression(new TypeReferenceExpression(
				"System.ComponentModel.EditorBrowsableState"), "Never"));

			section.Attributes.Add(attribute);
			node.Attributes.Add(section);
		}
开发者ID:dw4dev,项目名称:Phalanger,代码行数:16,代码来源:Utility.cs


示例6: VisitAttributeSection

        public override void VisitAttributeSection(AttributeSection attributeSection)
        {
            if (attributeSection.AttributeTarget != "assembly")
            {
                return;
            }

            foreach (var attr in attributeSection.Attributes)
            {
                var name = attr.Type.ToString();
                var resolveResult = this.Resolver.ResolveNode(attr, null);

                var handled = //this.ReadAspect(attr, name, resolveResult, AttributeTargets.Assembly, null) ||
                              this.ReadModuleInfo(attr, name, resolveResult) ||
                              this.ReadFileNameInfo(attr, name, resolveResult) ||
                              this.ReadOutputPathInfo(attr, name, resolveResult) ||
                              this.ReadFileHierarchyInfo(attr, name, resolveResult) ||
                              this.ReadModuleDependency(attr, name, resolveResult);
            }
        }
开发者ID:Oaz,项目名称:bridgedotnet_Builder,代码行数:20,代码来源:Inspector.Visitor.cs


示例7: GetActions

			IEnumerable<CodeAction> GetActions(Attribute attribute, AttributeSection attributeSection, FieldDeclaration fieldDeclaration)
			{
				string removeAttributeMessage = ctx.TranslateString("Remove attribute");
				yield return new CodeAction(removeAttributeMessage, script => {
					if (attributeSection.Attributes.Count > 1) {
						var newSection = new AttributeSection();
						newSection.AttributeTarget = attributeSection.AttributeTarget;
						foreach (var attr in attributeSection.Attributes) {
							if (attr != attribute)
								newSection.Attributes.Add((Attribute)attr.Clone());
						}
						script.Replace(attributeSection, newSection);
					} else {
						script.Remove(attributeSection);
					}
				});

				var makeStaticMessage = ctx.TranslateString("Make the field static");
				yield return new CodeAction(makeStaticMessage, script => {
					var newDeclaration = (FieldDeclaration)fieldDeclaration.Clone();
					newDeclaration.Modifiers |= Modifiers.Static;
					script.Replace(fieldDeclaration, newDeclaration);
				});
			}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:24,代码来源:ThreadStaticOnInstanceFieldIssue.cs


示例8: Generate

        private string Generate(String propertyName, String propertyTypeName, string indent)
        {
            // Create the attribute
            AttributeSection attributeSection = new AttributeSection ();
            var attribute = GetAttribute(Constants.OBJECTIVE_C_IVAR_SHORTFORM, propertyName);
            attributeSection.Attributes.Add (attribute);

            // Create the property declaration
            PropertyDeclaration propertyDeclaration = GetPropertyDeclaration(propertyName, new SimpleType (propertyTypeName), attributeSection);

            {
                // Create the member this.GetInstanceVariable<T>
                MemberReferenceExpression memberReferenceExpression = new MemberReferenceExpression (new ThisReferenceExpression (), "GetInstanceVariable");
                memberReferenceExpression.TypeArguments.Add (new SimpleType (propertyTypeName));

                // Create the invocation with arguments
                InvocationExpression invocationExpression = new InvocationExpression (memberReferenceExpression, new List<Expression> { new PrimitiveExpression (propertyName) });

                // Wrap the invocation with a return
                ReturnStatement returnStatement = new ReturnStatement (invocationExpression);

                // Create the "get" region
                propertyDeclaration.Getter = new Accessor();
                propertyDeclaration.Getter.Body = new BlockStatement ();
                propertyDeclaration.Getter.Body.Add(returnStatement);
            }

            {
                // Create the member this.SetInstanceVariable<T>
                MemberReferenceExpression memberReferenceExpression = new MemberReferenceExpression (new ThisReferenceExpression (), "SetInstanceVariable");
                memberReferenceExpression.TypeArguments.Add (new SimpleType (propertyTypeName));

                // Create the invocation with arguments
                InvocationExpression invocationExpression = new InvocationExpression (memberReferenceExpression, new List<Expression> { new PrimitiveExpression (propertyName), new IdentifierExpression ("value") });

                // Wrap the invocation with an expression
                ExpressionStatement expressionStatement = new ExpressionStatement (invocationExpression);

                // Create the "set" region
                propertyDeclaration.Setter = new Accessor();
                propertyDeclaration.Setter.Body = new BlockStatement ();
                propertyDeclaration.Setter.Body.Add(expressionStatement);
            }

            // Return the result of the AST generation
            String generated = this.Options.OutputNode(propertyDeclaration);

            // Add ident space
            return Indent(generated, indent);
        }
开发者ID:Monobjc,项目名称:monobjc-monodevelop,代码行数:50,代码来源:CreateIVarDialog.cs


示例9: ConvertAttributeSection

			AttributeSection ConvertAttributeSection (List<Mono.CSharp.Attribute> optAttributes)
			{
				if (optAttributes == null)
					return null;
				
				AttributeSection result = new AttributeSection ();
				var loc = LocationsBag.GetLocations (optAttributes);
				if (loc != null)
					result.AddChild (new CSharpTokenNode (Convert (loc [0]), 1), AttributeSection.Roles.LBracket);
				
				result.AttributeTarget = optAttributes.First ().ExplicitTarget;
				foreach (var attr in GetAttributes (optAttributes)) {
					result.AddChild (attr, AttributeSection.AttributeRole);
				}
				
				if (loc != null)
					result.AddChild (new CSharpTokenNode (Convert (loc [1]), 1), AttributeSection.Roles.RBracket);
				return result;
			}
开发者ID:aleksandersumowski,项目名称:monodevelop,代码行数:19,代码来源:CSharpParser.cs


示例10: Bind

		void Bind(CXXRecordDecl baseDecl, CXXRecordDecl decl)
		{
			var name = decl.Name;
			//Console.WriteLine(name);

			bool isStruct = IsStructure (decl);

			PushType(new TypeDeclaration
			{
				Name = RemapTypeName (decl.Name),
				ClassType = isStruct ? ClassType.Struct : ClassType.Class,
				Modifiers = Modifiers.Partial | Modifiers.Public | Modifiers.Unsafe
			}, StringUtil.GetTypeComments(decl));

			if (baseDecl != null) {
				foreach (var baseType in decl.Bases) {
					var baseName = baseType.Decl?.Name;
					if (baseName == null)
						continue;

					// WorkItem is a structure, with a RefCount base class, avoid that
					if (IsStructure(decl))
						continue;
					// 
					// Only a (File, MemoryBuffer, VectorBuffer)
					// implement that, and the Serializer class is never
					// surfaced as an API entry point, so we should just inline the methods
					// from those classes into the generated class
					//
					if (baseName == "GPUObject" || baseName == "Thread" || baseName == "Octant" ||
						baseName == "b2Draw" || baseName == "b2ContactListener" || baseName == "btIDebugDraw" || baseName == "btMotionState")
						continue;

					if (currentType.BaseTypes.Count > 0)
						baseName = "I" + baseName;

					currentType.BaseTypes.Add(new SimpleType(RemapTypeName(baseName)));
				}
			}

			// Determines if this is a subclass of RefCounted (but not RefCounted itself)
			bool refCountedSubclass = decl.TagKind == TagDeclKind.Class && decl.QualifiedName != "Urho3D::RefCounted" && decl.IsDerivedFrom(ScanBaseTypes.UrhoRefCounted);
			// Same for Urho3D::Object
			bool objectSubclass = decl.TagKind == TagDeclKind.Class && decl.QualifiedName != "Urho3D::Object" && decl.IsDerivedFrom(ScanBaseTypes.UrhoObjectType);

			if (refCountedSubclass) {
				var nativeCtor = new ConstructorDeclaration
				{
					Modifiers = Modifiers.Public,
					Body = new BlockStatement(),
					Initializer = new ConstructorInitializer()
				};
				

				nativeCtor.Parameters.Add(new ParameterDeclaration(new SimpleType("IntPtr"), "handle"));
				nativeCtor.Initializer.Arguments.Add(new IdentifierExpression("handle"));

				currentType.Members.Add(nativeCtor);

				// The construtor with the emtpy chain flag
				nativeCtor = new ConstructorDeclaration
				{
					Modifiers = Modifiers.Protected,
					Body = new BlockStatement(),
					Initializer = new ConstructorInitializer()
				};


				nativeCtor.Parameters.Add(new ParameterDeclaration(new SimpleType("UrhoObjectFlag"), "emptyFlag"));
				nativeCtor.Initializer.Arguments.Add(new IdentifierExpression("emptyFlag"));

				currentType.Members.Add(nativeCtor);

			} else if (IsStructure(decl)) {
				var serializable = new Attribute()
				{
					Type = new SimpleType("StructLayout")
				};

				serializable.Arguments.Add(new TypeReferenceExpression(new MemberType(new SimpleType("LayoutKind"), "Sequential")));
				var attrs = new AttributeSection();
				attrs.Attributes.Add(serializable);
				currentType.Attributes.Add(attrs);
			}
		}
开发者ID:corefan,项目名称:urho,代码行数:85,代码来源:CxxBinder.cs


示例11: ConvertCustomAttributes

		static void ConvertCustomAttributes(AstNode attributedNode, ICustomAttributeProvider customAttributeProvider, AttributeTarget target = AttributeTarget.None)
		{
			if (customAttributeProvider.HasCustomAttributes) {
				var attributes = new List<ICSharpCode.NRefactory.CSharp.Attribute>();
				foreach (var customAttribute in customAttributeProvider.CustomAttributes) {
					var attribute = new ICSharpCode.NRefactory.CSharp.Attribute();
					attribute.AddAnnotation(customAttribute);
					attribute.Type = ConvertType(customAttribute.AttributeType);
					attributes.Add(attribute);
					
					SimpleType st = attribute.Type as SimpleType;
					if (st != null && st.Identifier.EndsWith("Attribute", StringComparison.Ordinal)) {
						st.Identifier = st.Identifier.Substring(0, st.Identifier.Length - "Attribute".Length);
					}

					if(customAttribute.HasConstructorArguments) {
						foreach (var parameter in customAttribute.ConstructorArguments) {
							Expression parameterValue = ConvertArgumentValue(parameter);
							attribute.Arguments.Add(parameterValue);
						}
					}
					if (customAttribute.HasProperties) {
						TypeDefinition resolvedAttributeType = customAttribute.AttributeType.Resolve();
						foreach (var propertyNamedArg in customAttribute.Properties) {
							var propertyReference = resolvedAttributeType != null ? resolvedAttributeType.Properties.FirstOrDefault(pr => pr.Name == propertyNamedArg.Name) : null;
							var propertyName = new IdentifierExpression(propertyNamedArg.Name).WithAnnotation(propertyReference);
							var argumentValue = ConvertArgumentValue(propertyNamedArg.Argument);
							attribute.Arguments.Add(new AssignmentExpression(propertyName, argumentValue));
						}
					}

					if (customAttribute.HasFields) {
						TypeDefinition resolvedAttributeType = customAttribute.AttributeType.Resolve();
						foreach (var fieldNamedArg in customAttribute.Fields) {
							var fieldReference = resolvedAttributeType != null ? resolvedAttributeType.Fields.FirstOrDefault(f => f.Name == fieldNamedArg.Name) : null;
							var fieldName = new IdentifierExpression(fieldNamedArg.Name).WithAnnotation(fieldReference);
							var argumentValue = ConvertArgumentValue(fieldNamedArg.Argument);
							attribute.Arguments.Add(new AssignmentExpression(fieldName, argumentValue));
						}
					}
				}

				if (target == AttributeTarget.Module || target == AttributeTarget.Assembly) {
					// use separate section for each attribute
					foreach (var attribute in attributes) {
						var section = new AttributeSection();
						section.AttributeTarget = target;
						section.Attributes.Add(attribute);
						attributedNode.AddChild(section, AttributedNode.AttributeRole);
					}
				} else {
					// use single section for all attributes
					var section = new AttributeSection();
					section.AttributeTarget = target;
					section.Attributes.AddRange(attributes);
					attributedNode.AddChild(section, AttributedNode.AttributeRole);
				}
			}
		}
开发者ID:eldersantos,项目名称:ILSpy,代码行数:59,代码来源:AstBuilder.cs


示例12: GenerateMethod

        private String GenerateMethod(IMethod method)
        {
            // Retrieve the Objective-C message in the attribute
            String message = AttributeHelper.GetAttributeValue (method, Constants.OBJECTIVE_C_MESSAGE);
            AttributeSection attributeSection = new AttributeSection ();
            if (!String.IsNullOrEmpty (message)) {
                var attribute = this.GetAttribute (Constants.OBJECTIVE_C_MESSAGE_SHORTFORM, message);
                attributeSection.Attributes.Add (attribute);
            }

            // Create the method declaration
            MethodDeclaration methodDeclaration = new MethodDeclaration ();
            methodDeclaration.Name = method.Name;
            methodDeclaration.Attributes.Add (attributeSection);
            methodDeclaration.Modifiers = Modifiers.Public | Modifiers.Virtual;
            methodDeclaration.ReturnType = this.Options.CreateShortType (method.ReturnType);

            foreach (var parameter in method.Parameters) {
                ParameterDeclaration parameterDeclaration = new ParameterDeclaration (this.Options.CreateShortType (parameter.Type), parameter.Name);
                if (parameter.IsOut) {
                    parameterDeclaration.ParameterModifier |= ParameterModifier.Out;
                }
                if (parameter.IsRef) {
                    parameterDeclaration.ParameterModifier |= ParameterModifier.Ref;
                }
                methodDeclaration.Parameters.Add (parameterDeclaration);
            }

            // Create the method body
            methodDeclaration.Body = new BlockStatement ();
            ThrowStatement throwStatement = this.GetThrowStatement (Constants.NOT_IMPLEMENTED_EXCEPTION);
            methodDeclaration.Body.Add (throwStatement);

            // Return the result of the AST generation
            return this.Options.OutputNode (methodDeclaration);
        }
开发者ID:Monobjc,项目名称:monobjc-monodevelop,代码行数:36,代码来源:ImplementProtocolDialog.cs


示例13: VisitAttributeSection

 public StringBuilder VisitAttributeSection(AttributeSection attributeSection, int data)
 {
     throw new SLSharpException("HLSL does not have attributes.");
 }
开发者ID:hach-que,项目名称:SLSharp,代码行数:4,代码来源:VisitorBase.Illegal.cs


示例14: ConvertAttributeSection

			AttributeSection ConvertAttributeSection(IEnumerable<Mono.CSharp.Attribute> optAttributes)
			{
				if (optAttributes == null)
					return null;
				var result = new AttributeSection();
				var loc = LocationsBag.GetLocations(optAttributes);
				int pos = 0;
				if (loc != null)
					result.AddChild(new CSharpTokenNode(Convert(loc [pos++]), Roles.LBracket), Roles.LBracket);
				var first = optAttributes.FirstOrDefault();
				string target = first != null ? first.ExplicitTarget : null;
				
				if (!string.IsNullOrEmpty(target)) {
					if (loc != null && pos < loc.Count - 1) {
						result.AddChild(Identifier.Create(target, Convert(loc [pos++])), Roles.Identifier);
					} else {
						result.AddChild(Identifier.Create(target), Roles.Identifier);
					}
					if (loc != null && pos < loc.Count)
						result.AddChild(new CSharpTokenNode(Convert(loc [pos++]), Roles.Colon), Roles.Colon);
				}

				int attributeCount = 0;
				foreach (var attr in GetAttributes (optAttributes)) {
					result.AddChild(attr, Roles.Attribute);
					if (loc != null && pos + 1 < loc.Count)
						result.AddChild(new CSharpTokenNode(Convert(loc [pos++]), Roles.Comma), Roles.Comma);

					attributeCount++;
				}
				if (attributeCount == 0)
					return null;
				// Left and right bracket + commas between the attributes
				int locCount = 2 + attributeCount - 1;
				// optional comma
				if (loc != null && pos < loc.Count - 1 && loc.Count == locCount + 1)
					result.AddChild(new CSharpTokenNode(Convert(loc [pos++]), Roles.Comma), Roles.Comma);
				if (loc != null && pos < loc.Count)
					result.AddChild(new CSharpTokenNode(Convert(loc [pos++]), Roles.RBracket), Roles.RBracket);
				return result;
			}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:41,代码来源:CSharpParser.cs


示例15: VisitAttributeSection

		public void VisitAttributeSection(AttributeSection attributeSection)
		{
			StartNode(attributeSection);
			WriteToken(Roles.LBracket);
			if (!string.IsNullOrEmpty(attributeSection.AttributeTarget)) {
				WriteToken(attributeSection.AttributeTarget, Roles.AttributeTargetRole);
				WriteToken(Roles.Colon);
				Space();
			}
			WriteCommaSeparatedList(attributeSection.Attributes);
			WriteToken(Roles.RBracket);
			if (attributeSection.Parent is ParameterDeclaration || attributeSection.Parent is TypeParameterDeclaration) {
				Space();
			} else {
				NewLine();
			}
			EndNode(attributeSection);
		}
开发者ID:x-strong,项目名称:ILSpy,代码行数:18,代码来源:CSharpOutputVisitor.cs


示例16: VBAttributeSectionPrinter

 public VBAttributeSectionPrinter(AttributeSection obj)
 {
     this.obj = obj;
 }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:4,代码来源:VBAttributeSectionPrinter.cs


示例17: AddAttribute

		void AddAttribute(DomRegion region, IAttribute attribute, string target = "")
		{
			var view = SD.FileService.OpenFile(new FileName(region.FileName), false);
			var editor = view.GetRequiredService<ITextEditor>();
			var context = SDRefactoringContext.Create(editor.FileName, editor.Document, region.Begin, CancellationToken.None);
			var node = context.RootNode.GetNodeAt<EntityDeclaration>(region.Begin);
			var resolver = context.GetResolverStateBefore(node);
			var builder = new TypeSystemAstBuilder(resolver);
			
			using (Script script = context.StartScript()) {
				var attr = new AttributeSection();
				attr.AttributeTarget = target;
				attr.Attributes.Add(builder.ConvertAttribute(attribute));
				script.InsertBefore(node, attr);
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:16,代码来源:CSharpCodeGenerator.cs


示例18: VisitAttributeSection

		public virtual void VisitAttributeSection(AttributeSection attributeSection)
		{
			StartNode(attributeSection);
			var braceHelper = BraceHelper.LeftBracket(this, CodeBracesRangeFlags.SquareBrackets);
			if (!string.IsNullOrEmpty(attributeSection.AttributeTarget)) {
				WriteKeyword(attributeSection.AttributeTarget, Roles.Identifier);
				WriteToken(Roles.Colon, BoxedTextColor.Punctuation);
				Space();
			}
			WriteCommaSeparatedList(attributeSection.Attributes);
			braceHelper.RightBracket();
			if (attributeSection.Parent is ParameterDeclaration || attributeSection.Parent is TypeParameterDeclaration) {
				Space();
			} else {
				NewLine();
			}
			EndNode(attributeSection);
		}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:18,代码来源:CSharpOutputVisitor.cs


示例19: AttributeSection

	void AttributeSection(
#line  288 "cs.ATG" 
out AttributeSection section) {

#line  290 "cs.ATG" 
		string attributeTarget = "";
		List<ASTAttribute> attributes = new List<ASTAttribute>();
		ASTAttribute attribute;
		
		
		Expect(18);

#line  296 "cs.ATG" 
		Location startPos = t.Location; 
		if (
#line  297 "cs.ATG" 
IsLocalAttrTarget()) {
			if (la.kind == 69) {
				lexer.NextToken();

#line  298 "cs.ATG" 
				attributeTarget = "event";
			} else if (la.kind == 101) {
				lexer.NextToken();

#line  299 "cs.ATG" 
				attributeTarget = "return";
			} else {
				Identifier();

#line  300 "cs.ATG" 
				if (t.val != "field"   && t.val != "method" &&
				  t.val != "param" &&
				  t.val != "property" && t.val != "type")
				Error("attribute target specifier (field, event, method, param, property, return or type) expected");
				attributeTarget = t.val;
				
			}
			Expect(9);
		}
		Attribute(
#line  309 "cs.ATG" 
out attribute);

#line  309 "cs.ATG" 
		attributes.Add(attribute); 
		while (
#line  310 "cs.ATG" 
NotFinalComma()) {
			Expect(14);
			Attribute(
#line  310 "cs.ATG" 
out attribute);

#line  310 "cs.ATG" 
			attributes.Add(attribute); 
		}
		if (la.kind == 14) {
			lexer.NextToken();
		}
		Expect(19);

#line  312 "cs.ATG" 
		section = new AttributeSection {
		   AttributeTarget = attributeTarget,
		   Attributes = attributes,
		   StartLocation = startPos,
		   EndLocation = t.EndLocation
		};
		
	}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:71,代码来源:Parser.cs


示例20: GlobalAttributeSection

	void GlobalAttributeSection() {
		Expect(18);

#line  213 "cs.ATG" 
		Location startPos = t.Location; 
		Identifier();

#line  214 "cs.ATG" 
		if (t.val != "assembly" && t.val != "module") Error("global attribute target specifier (assembly or module) expected");
		string attributeTarget = t.val;
		List<ASTAttribute> attributes = new List<ASTAttribute>();
		ASTAttribute attribute;
		
		Expect(9);
		Attribute(
#line  219 "cs.ATG" 
out attribute);

#line  219 "cs.ATG" 
		attributes.Add(attribute); 
		while (
#line  220 "cs.ATG" 
NotFinalComma()) {
			Expect(14);
			Attribute(
#line  220 "cs.ATG" 
out attribute);

#line  220 "cs.ATG" 
			attributes.Add(attribute); 
		}
		if (la.kind == 14) {
			lexer.NextToken();
		}
		Expect(19);

#line  222 "cs.ATG" 
		AttributeSection section = new AttributeSection {
		   AttributeTarget = attributeTarget,
		   Attributes = attributes,
		   StartLocation = startPos,
		   EndLocation = t.EndLocation
		};
		compilationUnit.AddChild(section);
		
	}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:46,代码来源:Parser.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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