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

C# Ast.AttributeSection类代码示例

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

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



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

示例1: 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:XQuantumForceX,项目名称:Reflexil,代码行数:9,代码来源:AbstractASTVisitor.cs


示例2: CreateAttributeSection

 private AttributeSection CreateAttributeSection(string attributeName, List<Expression> args)
 {
     Attribute attribute = new Attribute(attributeName, args, null);
     List<Attribute> attributes = new List<Attribute>();
     attributes.Add(attribute);
     AttributeSection attributeSection = new AttributeSection("", attributes);
     attribute.Parent = attributeSection;
     return attributeSection;
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:9,代码来源:JavaModifiersTransformer.cs


示例3: TrackedVisitMethodDeclaration

        public override object TrackedVisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
        {
            TypeDeclaration typeDeclaration = (TypeDeclaration) methodDeclaration.Parent;
            string testcase = "junit.framework.TestCase";
            if (typeDeclaration != null && ((IsDerivedFrom(typeDeclaration, testcase) &&
                                             !(typeDeclaration.Name.StartsWith("Abstract"))) || IsAllTestRunner(typeDeclaration.Name)))
            {
                if (methodDeclaration.Name == "main" || methodDeclaration.Name == "suite")
                    RemoveCurrentNode();

                else if (methodDeclaration.Name.StartsWith("test"))
                {
                    MethodDeclaration replaced = methodDeclaration;
                    Attribute attr = new Attribute("NUnit.Framework.Test", null, null);
                    List<Attribute> attributes = new List<Attribute>();
                    attributes.Add(attr);
                    AttributeSection testAttribute = new AttributeSection(null, attributes);
                    replaced.Attributes.Add(testAttribute);
                    AstUtil.RemoveModifierFrom(replaced, Modifiers.Static);

                    ReplaceCurrentNode(replaced);
                }
                else if (methodDeclaration.Name == "setUp" || methodDeclaration.Name == "tearDown")
                {
                    if (Mode == "DotNet")
                    {
                        MethodDeclaration replaced = methodDeclaration;
                        replaced.Modifier = Modifiers.Public;

                        string attributeName = "NUnit.Framework.SetUp";
                        if (methodDeclaration.Name == "tearDown")
                            attributeName = "NUnit.Framework.TearDown";

                        Attribute attribute = new Attribute(attributeName, null, null);
                        List<Attribute> attributes = new List<Attribute>();
                        attributes.Add(attribute);
                        AttributeSection attributeSection = new AttributeSection(null, attributes);
                        replaced.Attributes.Add(attributeSection);

                        ReplaceCurrentNode(replaced);
                    }
                    else if (Mode == "IKVM")
                    {
                        methodDeclaration.Modifier = Modifiers.Protected | Modifiers.Override;
                    }
                }
            }
            return null;
        }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:49,代码来源:TestCaseTransformer.cs


示例4: TrackedVisitTypeDeclaration

        public override object TrackedVisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
        {
            if (IsDerivedFrom(typeDeclaration, "junit.framework.TestCase"))
            {
                if (!(typeDeclaration.Name.StartsWith("Abstract")))
                {
                    TypeDeclaration newType = typeDeclaration;
                    Attribute attr = new Attribute("NUnit.Framework.TestFixture", null, null);
                    List<Attribute> attributes = new List<Attribute>();
                    attributes.Add(attr);
                    AttributeSection attrSection = new AttributeSection(null, attributes);
                    newType.Attributes.Add(attrSection);

                    ReplaceCurrentNode(newType);
                }
            }
            return base.TrackedVisitTypeDeclaration(typeDeclaration, data);
        }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:18,代码来源:TestCaseTransformer.cs


示例5: TrackedVisitTypeDeclaration

        public override object TrackedVisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
        {
            int index = GetBaseTypeIndex(typeDeclaration, serializableType);
            if (index != -1)
            {
                Removeables.Add(serializableType);
                if (typeDeclaration.Type == ClassType.Class)
                {
                    List<Attribute> attributes = new List<Attribute>();
                    Attribute attribute = new Attribute("System.SerializableAttribute", null, null);
                    attributes.Add(attribute);
                    AttributeSection attributeSection = new AttributeSection("", attributes);

                    typeDeclaration.Attributes.Add(attributeSection);
                    attributeSection.Parent = typeDeclaration;
                }
                typeDeclaration = RemoveBaseTypeFrom(typeDeclaration, (TypeReference) typeDeclaration.BaseTypes[index]);
            }
            return base.TrackedVisitTypeDeclaration(typeDeclaration, data);
        }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:20,代码来源:SerializableTransformer.cs


示例6: CreateAreaAttributeCode

    private static AttributeSection CreateAreaAttributeCode(string attributeName, string argumentName, Expression valueExpression)
    {
      NamedArgumentExpression argument = new NamedArgumentExpression(argumentName, valueExpression);
	  Attribute attribute = new Attribute(attributeName, new List<Expression>(), new List<NamedArgumentExpression>());
      attribute.NamedArguments.Add(argument);
	  AttributeSection attributeSection = new AttributeSection("IDontKnow", new List<Attribute>());
      attributeSection.Attributes.Add(attribute);
      return attributeSection;
    }
开发者ID:mgagne-atman,项目名称:Projects,代码行数:9,代码来源:ControllerVisitorTests.cs


示例7: AttributeSection

	void AttributeSection(
#line  291 "Frames/cs.ATG" 
out AttributeSection section) {

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

#line  299 "Frames/cs.ATG" 
		Location startPos = t.Location; 
		if (
#line  300 "Frames/cs.ATG" 
IsLocalAttrTarget()) {
			if (la.kind == 69) {
				lexer.NextToken();

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

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

#line  303 "Frames/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  312 "Frames/cs.ATG" 
out attribute);

#line  312 "Frames/cs.ATG" 
		attributes.Add(attribute); 
		while (
#line  313 "Frames/cs.ATG" 
NotFinalComma()) {
			Expect(14);
			Attribute(
#line  313 "Frames/cs.ATG" 
out attribute);

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

#line  315 "Frames/cs.ATG" 
		section = new AttributeSection {
		   AttributeTarget = attributeTarget,
		   Attributes = attributes,
		   StartLocation = startPos,
		   EndLocation = t.EndLocation
		};
		
	}
开发者ID:okrmartin,项目名称:monodevelop,代码行数:71,代码来源:Parser.cs


示例8: VisitDeclareDeclaration

        public override object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data)
        {
            if (usings != null && !usings.ContainsKey("System.Runtime.InteropServices")) {
                UsingDeclaration @using = new UsingDeclaration("System.Runtime.InteropServices");
                addedUsings.Add(@using);
                base.VisitUsingDeclaration(@using, data);
            }

            MethodDeclaration method = new MethodDeclaration();
            method.Attributes = declareDeclaration.Attributes;
            method.Parameters = declareDeclaration.Parameters;
            method.TypeReference = declareDeclaration.TypeReference;
            method.Modifier = declareDeclaration.Modifier;
            method.Name = declareDeclaration.Name;

            if ((method.Modifier & Modifiers.Visibility) == 0)
                method.Modifier |= Modifiers.Public;
            method.Modifier |= Modifiers.Extern | Modifiers.Static;

            if (method.TypeReference.IsNull) {
                method.TypeReference = new TypeReference("System.Void", true);
            }

            Attribute att = new Attribute("DllImport", null, null);
            att.PositionalArguments.Add(CreateStringLiteral(declareDeclaration.Library));
            if (declareDeclaration.Alias.Length > 0) {
                att.NamedArguments.Add(new NamedArgumentExpression("EntryPoint", CreateStringLiteral(declareDeclaration.Alias)));
            }
            switch (declareDeclaration.Charset) {
                case CharsetModifier.Auto:
                    att.NamedArguments.Add(new NamedArgumentExpression("CharSet",
                                                                       new MemberReferenceExpression(new IdentifierExpression("CharSet"),
                                                                                                     "Auto")));
                    break;
                case CharsetModifier.Unicode:
                    att.NamedArguments.Add(new NamedArgumentExpression("CharSet",
                                                                       new MemberReferenceExpression(new IdentifierExpression("CharSet"),
                                                                                                     "Unicode")));
                    break;
                default:
                    att.NamedArguments.Add(new NamedArgumentExpression("CharSet",
                                                                       new MemberReferenceExpression(new IdentifierExpression("CharSet"),
                                                                                                     "Ansi")));
                    break;
            }
            att.NamedArguments.Add(new NamedArgumentExpression("SetLastError", new PrimitiveExpression(true, true.ToString())));
            att.NamedArguments.Add(new NamedArgumentExpression("ExactSpelling", new PrimitiveExpression(true, true.ToString())));
            var attributeSection = new AttributeSection();
            attributeSection.Attributes = new List<Attribute>().add(att);
            method.Attributes.Add(attributeSection);
            ReplaceCurrentNode(method);
            return base.VisitMethodDeclaration(method, data);
        }
开发者ID:SergeTruth,项目名称:OxyChart,代码行数:53,代码来源:VBNetConstructsConvertVisitor.cs


示例9: VisitTypeDeclaration_AControllerWithRestRoutesAttribute_ExtractsRestRoutesData

		public void VisitTypeDeclaration_AControllerWithRestRoutesAttribute_ExtractsRestRoutesData()
		{
			var routeName = "restController";
			var routeCollection = "/part1/<key>/part2";
			var routeIdentifier = "<id>";
			var routeRestVerbResolverType = typeof(CustomRestVerbResolver).FullName;

			var type = new TypeDeclaration(Modifiers.Public | Modifiers.Partial, new List<AttributeSection>()) { Name = ControllerName };
			var attribute = new Attribute("RestRoutes", new List<Expression>(), new List<NamedArgumentExpression>());
			attribute.PositionalArguments.AddRange(new Expression[]
			{
				new PrimitiveExpression("restController", "restController"),
				new PrimitiveExpression("/part1/<key>/part2", "/part1/<key>/part2"),
				new PrimitiveExpression("<id>", "<id>"),
				new TypeOfExpression(new TypeReference(routeRestVerbResolverType))
			});

			var section = new AttributeSection();
			section.Attributes.Add(attribute);
			type.Attributes.Add(section);

			typeResolver.Expect(r => r.Resolve(Arg<TypeReference>.Matches(t => t.Type == routeRestVerbResolverType))).Return(
				routeRestVerbResolverType);

			visitor.VisitTypeDeclaration(type, null);

			treeService.AssertWasCalled(
				s => s.PushNode(Arg<ControllerTreeNode>.Matches(
					n => n.Name == ControllerName && 
						 n.RestRoutesDescriptor.Name == routeName &&
						 n.RestRoutesDescriptor.Collection == routeCollection &&
						 n.RestRoutesDescriptor.Identifier == routeIdentifier &&
						 n.RestRoutesDescriptor.RestVerbResolverType == routeRestVerbResolverType)));
			treeService.AssertWasCalled(s => s.PopNode());
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:35,代码来源:ControllerVisitorTests.cs


示例10: VisitAttributeSection

 public virtual object VisitAttributeSection(AttributeSection attributeSection, object data) {
     throw CreateException(attributeSection);
 }
开发者ID:hallvar,项目名称:Joddes.CS,代码行数:3,代码来源:JsVisitor.cs


示例11: TrackedVisitAttributeSection

		public virtual object TrackedVisitAttributeSection(AttributeSection attributeSection, object data) {
			return base.VisitAttributeSection(attributeSection, data);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:3,代码来源:NodeTrackingAstVisitor.cs


示例12: GlobalAttributeSection

	void GlobalAttributeSection() {
		Expect(40);

//#line  2823 "VBNET.ATG" 
		Location startPos = t.Location; 
		if (la.kind == 65) {
			lexer.NextToken();
		} else if (la.kind == 155) {
			lexer.NextToken();
		} else SynErr(243);

//#line  2825 "VBNET.ATG" 
		string attributeTarget = t.val != null ? t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture) : null;
		List<ASTAttribute> attributes = new List<ASTAttribute>();
		ASTAttribute attribute;
		
		Expect(21);
		Attribute(
//#line  2829 "VBNET.ATG" 
out attribute);

//#line  2829 "VBNET.ATG" 
		attributes.Add(attribute); 
		while (
//#line  2830 "VBNET.ATG" 
NotFinalComma()) {
			if (la.kind == 22) {
				lexer.NextToken();
				if (la.kind == 65) {
					lexer.NextToken();
				} else if (la.kind == 155) {
					lexer.NextToken();
				} else SynErr(244);
				Expect(21);
			}
			Attribute(
//#line  2830 "VBNET.ATG" 
out attribute);

//#line  2830 "VBNET.ATG" 
			attributes.Add(attribute); 
		}
		if (la.kind == 22) {
			lexer.NextToken();
		}
		Expect(39);
		EndOfStmt();

//#line  2835 "VBNET.ATG" 
		AttributeSection section = new AttributeSection {
		AttributeTarget = attributeTarget,
		Attributes = attributes,
		StartLocation = startPos,
		EndLocation = t.EndLocation
		};
		AddChild(section);
		
	}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:58,代码来源:Parser.cs


示例13: GlobalAttributeSection

	void GlobalAttributeSection() {
		Expect(28);

#line  2521 "VBNET.ATG" 
		Location startPos = t.Location; 
		if (la.kind == 52) {
			lexer.NextToken();
		} else if (la.kind == 141) {
			lexer.NextToken();
		} else SynErr(226);

#line  2523 "VBNET.ATG" 
		string attributeTarget = t.val != null ? t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture) : null;
		List<ASTAttribute> attributes = new List<ASTAttribute>();
		ASTAttribute attribute;
		
		Expect(11);
		Attribute(
#line  2527 "VBNET.ATG" 
out attribute);

#line  2527 "VBNET.ATG" 
		attributes.Add(attribute); 
		while (
#line  2528 "VBNET.ATG" 
NotFinalComma()) {
			if (la.kind == 12) {
				lexer.NextToken();
				if (la.kind == 52) {
					lexer.NextToken();
				} else if (la.kind == 141) {
					lexer.NextToken();
				} else SynErr(227);
				Expect(11);
			}
			Attribute(
#line  2528 "VBNET.ATG" 
out attribute);

#line  2528 "VBNET.ATG" 
			attributes.Add(attribute); 
		}
		if (la.kind == 12) {
			lexer.NextToken();
		}
		Expect(27);
		EndOfStmt();

#line  2533 "VBNET.ATG" 
		AttributeSection section = new AttributeSection {
		AttributeTarget = attributeTarget,
		Attributes = attributes,
		StartLocation = startPos,
		EndLocation = t.EndLocation
		};
		compilationUnit.AddChild(section);
		
	}
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:58,代码来源:Parser.cs


示例14: VisitAttributeSection

		public virtual object VisitAttributeSection(AttributeSection attributeSection, object data) {
			throw new global::System.NotImplementedException("AttributeSection");
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:3,代码来源:NotImplementedAstVisitor.cs


示例15: GlobalAttributeSection

	void GlobalAttributeSection() {
		Expect(18);

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

#line  223 "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  228 "cs.ATG" 
out attribute);

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

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

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


示例16: VisitAttributeSection

		public override object VisitAttributeSection(AttributeSection attributeSection, object data)
		{
			return base.VisitAttributeSection(attributeSection, data);
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:4,代码来源:NRefactoryAstVisitor.cs


示例17: CreateControllerAttributeCode

		private static AttributeSection CreateControllerAttributeCode(string attributeName, string argumentName, Expression valueExpression)
		{
			var argument = new NamedArgumentExpression(argumentName, valueExpression);
			
			var attribute = new Attribute(attributeName, new List<Expression>(), new List<NamedArgumentExpression>());
			attribute.NamedArguments.Add(argument);
			
			var attributeSection = new AttributeSection();
			attributeSection.Attributes.Add(attribute);
			
			return attributeSection;
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:12,代码来源:ControllerVisitorTests.cs


示例18: IsMatch

 private bool IsMatch(AttributeSection left, AttributeSection right)
 {
     return left.AttributeTarget == right.AttributeTarget;
 }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:4,代码来源:AstComparisonVisitor.cs


示例19: VisitAttributeSection

 public override object VisitAttributeSection(AttributeSection attributeSection, object data)
 {
     foreach (Attribute attribute in attributeSection.Attributes)
         attribute.Parent = attributeSection;
     return base.VisitAttributeSection(attributeSection, data);
 }
开发者ID:sourcewarehouse,项目名称:janett,代码行数:6,代码来源:ParentVisitor.cs


示例20: AttributeSection

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

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

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

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

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

#line  317 "cs.ATG" 
				attributeTarget = t.val; 
			}
			Expect(9);
		}
		Attribute(
#line  321 "cs.ATG" 
out attribute);

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

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

#line  324 "cs.ATG" 
		section = new AttributeSection {
		   AttributeTarget = attributeTarget,
		   Attributes = attributes,
		   StartLocation = startPos,
		   EndLocation = t.EndLocation
		};
		
	}
开发者ID:pluraldj,项目名称:SharpDevelop,代码行数:66,代码来源:Parser.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Ast.BinaryOperatorExpression类代码示例发布时间:2022-05-26
下一篇:
C# Ast.AssignmentExpression类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap