Inheritance: ICSharpCode.NRefactory.Ast.AbstractNode
		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;
		}
 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;
 }
Esempio n. 3
0
 public override object VisitAttributeSection(ICSharpCode.NRefactory.Ast.AttributeSection attributeSection, object data)
 {
     if (GetCurrentClass() == null)
     {
         ClassFinder cf = new ClassFinder(new DefaultClass(cu, "DummyClass"), attributeSection.StartLocation.Line, attributeSection.StartLocation.Column);
         cu.Attributes.AddRange(VisitAttributes(new[] { attributeSection }, cf));
     }
     return(null);
 }
        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;
        }
        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);
        }
        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);
        }
Esempio n. 7
0
	void GlobalAttributeSection() {
		Expect(27);

#line  2027 "VBNET.ATG" 
		Location startPos = t.Location; 
		if (la.kind == 49) {
			lexer.NextToken();
		} else if (la.kind == 121) {
			lexer.NextToken();
		} else SynErr(208);

#line  2029 "VBNET.ATG" 
		string attributeTarget = t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture);
		List<ASTAttribute> attributes = new List<ASTAttribute>();
		ASTAttribute attribute;
		
		Expect(13);
		Attribute(
#line  2033 "VBNET.ATG" 
out attribute);

#line  2033 "VBNET.ATG" 
		attributes.Add(attribute); 
		while (
#line  2034 "VBNET.ATG" 
NotFinalComma()) {
			if (la.kind == 12) {
				lexer.NextToken();
				if (la.kind == 49) {
					lexer.NextToken();
				} else if (la.kind == 121) {
					lexer.NextToken();
				} else SynErr(209);
				Expect(13);
			}
			Attribute(
#line  2034 "VBNET.ATG" 
out attribute);

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

#line  2039 "VBNET.ATG" 
		AttributeSection section = new AttributeSection(attributeTarget, attributes);
		section.StartLocation = startPos;
		section.EndLocation = t.EndLocation;
		compilationUnit.AddChild(section);
		
	}
    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;
    }
        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);
        }
Esempio n. 10
0
	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
		};
		
	}
Esempio n. 11
0
	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);
		
	}
		public virtual object TrackedVisitAttributeSection(AttributeSection attributeSection, object data) {
			return base.VisitAttributeSection(attributeSection, data);
		}
Esempio n. 13
0
		public virtual object VisitAttributeSection(AttributeSection attributeSection, object data) {
			throw new global::System.NotImplementedException("AttributeSection");
		}
Esempio n. 14
0
	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);
		
	}
Esempio n. 15
0
	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);
		
	}
Esempio n. 16
0
		public override object VisitAttributeSection(AttributeSection attributeSection, object data)
		{
			return base.VisitAttributeSection(attributeSection, data);
		}
		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());
		}
 private bool IsMatch(AttributeSection left, AttributeSection right)
 {
     return left.AttributeTarget == right.AttributeTarget;
 }
Esempio n. 19
0
 public override object VisitAttributeSection(AttributeSection attributeSection, object data)
 {
     foreach (Attribute attribute in attributeSection.Attributes)
         attribute.Parent = attributeSection;
     return base.VisitAttributeSection(attributeSection, data);
 }
		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;
		}
Esempio n. 21
0
	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
		};
		
	}
 public virtual bool VisitAttributeSection(AttributeSection attributeSection, object d)
 {
     if ((attributeSection == null)) {
         return SetFailure();
     }
     if ((d == null)) {
         return SetFailure();
     }
     if ((attributeSection.Attributes == null)) {
         return SetFailure();
     }
     if(attributeSection.GetType() != d.GetType()) {return SetFailure();}
     var data = (AttributeSection)d;
     if (!IsMatch(attributeSection, data)) {
         return SetFailure();
     }
     if (attributeSection.Attributes.Count == data.Attributes.Count) {
     for (int i=0; i<attributeSection.Attributes.Count;i++) {
         ICSharpCode.NRefactory.Ast.Attribute o = attributeSection.Attributes[i];
         if(o == null){return SetFailure();}
         if((bool)o.AcceptVisitor(this, data.Attributes[i]) == false) return SetFailure();
     }			}			else { return SetFailure(); }
     return true;
 }
Esempio n. 23
0
	void AttributeSection(
#line  2596 "VBNET.ATG" 
out AttributeSection section) {

#line  2598 "VBNET.ATG" 
		string attributeTarget = "";List<ASTAttribute> attributes = new List<ASTAttribute>();
		ASTAttribute attribute;
		
		
		Expect(28);

#line  2602 "VBNET.ATG" 
		Location startPos = t.Location; 
		if (
#line  2603 "VBNET.ATG" 
IsLocalAttrTarget()) {
			if (la.kind == 106) {
				lexer.NextToken();

#line  2604 "VBNET.ATG" 
				attributeTarget = "event";
			} else if (la.kind == 180) {
				lexer.NextToken();

#line  2605 "VBNET.ATG" 
				attributeTarget = "return";
			} else {
				Identifier();

#line  2608 "VBNET.ATG" 
				string val = t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture);
				if (val != "field"	|| val != "method" ||
					val != "module" || val != "param"  ||
					val != "property" || val != "type")
				Error("attribute target specifier (event, return, field," +
						"method, module, param, property, or type) expected");
				attributeTarget = t.val;
				
			}
			Expect(11);
		}
		Attribute(
#line  2618 "VBNET.ATG" 
out attribute);

#line  2618 "VBNET.ATG" 
		attributes.Add(attribute); 
		while (
#line  2619 "VBNET.ATG" 
NotFinalComma()) {
			Expect(12);
			Attribute(
#line  2619 "VBNET.ATG" 
out attribute);

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

#line  2623 "VBNET.ATG" 
		section = new AttributeSection {
		AttributeTarget = attributeTarget,
		Attributes = attributes,
		StartLocation = startPos,
		EndLocation = t.EndLocation
		};
		
	}
 public object VisitAttributeSection(AttributeSection attributeSection, object data)
 {
     throw new NotImplementedException ();
 }
		public sealed override object VisitAttributeSection(AttributeSection attributeSection, object data) {
			this.BeginVisit(attributeSection);
			object result = this.TrackedVisitAttributeSection(attributeSection, data);
			this.EndVisit(attributeSection);
			return result;
		}
		public object VisitAttributeSection(AttributeSection s, object data)
		{
			if (s.AttributeTarget.Equals("assembly", StringComparison.OrdinalIgnoreCase)) {
				foreach (ICSharpCode.NRefactory.Ast.Attribute a in s.Attributes) {
					module.AssemblyAttributes.Add((B.Attribute)VisitAttribute(a, null));
				}
			} else {
				AddError(s, "Attribute must have the target 'assembly'");
			}
			return null;
		}
 public override object TrackedVisitAttributeSection(AttributeSection attributeSection, object data)
 {
     return null;
 }
		public virtual object VisitAttributeSection(AttributeSection attributeSection, object data) {
			Debug.Assert((attributeSection != null));
			Debug.Assert((attributeSection.Attributes != null));
			for (int i = 0; i < attributeSection.Attributes.Count; i++) {
				ICSharpCode.NRefactory.Ast.Attribute o = attributeSection.Attributes[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (ICSharpCode.NRefactory.Ast.Attribute)nodeStack.Pop();
				if (o == null)
					attributeSection.Attributes.RemoveAt(i--);
				else
					attributeSection.Attributes[i] = o;
			}
			return null;
		}
Esempio n. 29
0
	void AttributeSection(
//#line  2901 "VBNET.ATG" 
out AttributeSection section) {

//#line  2903 "VBNET.ATG" 
		string attributeTarget = "";
		List<ASTAttribute> attributes = new List<ASTAttribute>();
		ASTAttribute attribute;
		Location startLocation = la.Location;
		
		Expect(40);
		if (
//#line  2909 "VBNET.ATG" 
IsLocalAttrTarget()) {
			if (la.kind == 119) {
				lexer.NextToken();

//#line  2910 "VBNET.ATG" 
				attributeTarget = "event";
			} else if (la.kind == 195) {
				lexer.NextToken();

//#line  2911 "VBNET.ATG" 
				attributeTarget = "return";
			} else {
				Identifier();

//#line  2914 "VBNET.ATG" 
				string val = t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture);
				if (val != "field"	|| val != "method" ||
					val != "module" || val != "param"  ||
					val != "property" || val != "type")
				Error("attribute target specifier (event, return, field," +
						"method, module, param, property, or type) expected");
				attributeTarget = t.val;
				
			}
			Expect(21);
		}
		Attribute(
//#line  2924 "VBNET.ATG" 
out attribute);

//#line  2924 "VBNET.ATG" 
		attributes.Add(attribute); 
		while (
//#line  2925 "VBNET.ATG" 
NotFinalComma()) {
			Expect(22);
			Attribute(
//#line  2925 "VBNET.ATG" 
out attribute);

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

//#line  2929 "VBNET.ATG" 
		section = new AttributeSection {
		AttributeTarget = attributeTarget,
		Attributes = attributes,
		StartLocation = startLocation,
		EndLocation = t.EndLocation
		};
		
	}
Esempio n. 30
0
 public virtual object VisitAttributeSection(AttributeSection attributeSection, object data) {
     throw CreateException(attributeSection);
 }