Inheritance: AttributedNode
		public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
		{
			// fix default visibility of inner classes
			if (currentTypeDeclaration != null && (delegateDeclaration.Modifier & Modifiers.Visibility) == 0)
				delegateDeclaration.Modifier |= Modifiers.Public;
			
			return base.VisitDelegateDeclaration(delegateDeclaration, data);
		}
Example #2
0
        public override object VisitDelegateDeclaration(AST.DelegateDeclaration delegateDeclaration, object data)
        {
            DomRegion    region = GetRegion(delegateDeclaration.StartLocation, delegateDeclaration.EndLocation);
            DefaultClass c      = new DefaultClass(cu, ClassType.Delegate, ConvertTypeModifier(delegateDeclaration.Modifier), region, GetCurrentClass());

            c.Documentation = GetDocumentation(region.BeginLine, delegateDeclaration.Attributes);
            ConvertAttributes(delegateDeclaration, c);
            CreateDelegate(c, delegateDeclaration.Name, delegateDeclaration.ReturnType,
                           delegateDeclaration.Templates, delegateDeclaration.Parameters);
            return(c);
        }
		void TestParameters(DelegateDeclaration dd)
		{
			Assert.AreEqual(3, dd.Parameters.Count);
			
			Assert.AreEqual("a", ((ParameterDeclarationExpression)dd.Parameters[0]).ParameterName);
			Assert.AreEqual("System.Int32", ((ParameterDeclarationExpression)dd.Parameters[0]).TypeReference.Type);
			
			Assert.AreEqual("secondParam", ((ParameterDeclarationExpression)dd.Parameters[1]).ParameterName);
			Assert.AreEqual("System.Int32", ((ParameterDeclarationExpression)dd.Parameters[1]).TypeReference.Type);
			
			Assert.AreEqual("lastParam", ((ParameterDeclarationExpression)dd.Parameters[2]).ParameterName);
			Assert.AreEqual("MyObj", ((ParameterDeclarationExpression)dd.Parameters[2]).TypeReference.Type);
		}
Example #4
0
 public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
 {
     if (!eventDeclaration.HasAddRegion && !eventDeclaration.HasRaiseRegion && !eventDeclaration.HasRemoveRegion) {
         if (eventDeclaration.TypeReference.IsNull) {
             DelegateDeclaration dd = new DelegateDeclaration(eventDeclaration.Modifier, null);
             dd.Name = eventDeclaration.Name + "EventHandler";
             dd.Parameters = eventDeclaration.Parameters;
             dd.ReturnType = new TypeReference("System.Void");
             dd.Parent = eventDeclaration.Parent;
             eventDeclaration.Parameters = null;
             InsertAfterSibling(eventDeclaration, dd);
             eventDeclaration.TypeReference = new TypeReference(dd.Name);
         }
     }
     return base.VisitEventDeclaration(eventDeclaration, data);
 }
		// The following conversions are implemented:
		//   Public Event EventName(param As String) -> automatic delegate declaration
		//   static variables inside methods become fields
		
		public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
		{
			if (!eventDeclaration.HasAddRegion && !eventDeclaration.HasRaiseRegion && !eventDeclaration.HasRemoveRegion) {
				if (eventDeclaration.TypeReference.IsNull) {
					DelegateDeclaration dd = new DelegateDeclaration(eventDeclaration.Modifier, null);
					dd.Name = eventDeclaration.Name + "EventHandler";
					dd.Parameters = eventDeclaration.Parameters;
					dd.ReturnType = new TypeReference("System.Void");
					dd.Parent = eventDeclaration.Parent;
					eventDeclaration.Parameters = null;
					int index = eventDeclaration.Parent.Children.IndexOf(eventDeclaration);
					// inserting before current position is not allowed in a Transformer
					eventDeclaration.Parent.Children.Insert(index + 1, dd);
					eventDeclaration.TypeReference = new TypeReference(dd.Name);
				}
			}
			return base.VisitEventDeclaration(eventDeclaration, data);
		}
Example #6
0
	void TypeDecl(
#line  371 "cs.ATG" 
ModifierList m, List<AttributeSection> attributes) {

#line  373 "cs.ATG" 
		TypeReference type;
		List<TypeReference> names;
		List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
		string name;
		List<TemplateDefinition> templates;
		
		if (la.kind == 59) {

#line  379 "cs.ATG" 
			m.Check(Modifiers.Classes); 
			lexer.NextToken();

#line  380 "cs.ATG" 
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			templates = newType.Templates;
			AddChild(newType);
			BlockStart(newType);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			
			newType.Type = Types.Class;
			
			Identifier();

#line  388 "cs.ATG" 
			newType.Name = t.val; 
			if (la.kind == 23) {
				TypeParameterList(
#line  391 "cs.ATG" 
templates);
			}
			if (la.kind == 9) {
				ClassBase(
#line  393 "cs.ATG" 
out names);

#line  393 "cs.ATG" 
				newType.BaseTypes = names; 
			}
			while (la.kind == 127) {
				TypeParameterConstraintsClause(
#line  396 "cs.ATG" 
templates);
			}

#line  398 "cs.ATG" 
			newType.BodyStartLocation = t.EndLocation; 
			Expect(16);
			ClassBody();
			Expect(17);
			if (la.kind == 11) {
				lexer.NextToken();
			}

#line  402 "cs.ATG" 
			newType.EndLocation = t.EndLocation; 
			BlockEnd();
			
		} else if (StartOf(9)) {

#line  405 "cs.ATG" 
			m.Check(Modifiers.StructsInterfacesEnumsDelegates); 
			if (la.kind == 109) {
				lexer.NextToken();

#line  406 "cs.ATG" 
				TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
				templates = newType.Templates;
				newType.StartLocation = m.GetDeclarationLocation(t.Location);
				AddChild(newType);
				BlockStart(newType);
				newType.Type = Types.Struct; 
				
				Identifier();

#line  413 "cs.ATG" 
				newType.Name = t.val; 
				if (la.kind == 23) {
					TypeParameterList(
#line  416 "cs.ATG" 
templates);
				}
				if (la.kind == 9) {
					StructInterfaces(
#line  418 "cs.ATG" 
out names);

#line  418 "cs.ATG" 
					newType.BaseTypes = names; 
				}
				while (la.kind == 127) {
					TypeParameterConstraintsClause(
#line  421 "cs.ATG" 
templates);
				}

#line  424 "cs.ATG" 
				newType.BodyStartLocation = t.EndLocation; 
				StructBody();
				if (la.kind == 11) {
					lexer.NextToken();
				}

#line  426 "cs.ATG" 
				newType.EndLocation = t.EndLocation; 
				BlockEnd();
				
			} else if (la.kind == 83) {
				lexer.NextToken();

#line  430 "cs.ATG" 
				TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
				templates = newType.Templates;
				AddChild(newType);
				BlockStart(newType);
				newType.StartLocation = m.GetDeclarationLocation(t.Location);
				newType.Type = Types.Interface;
				
				Identifier();

#line  437 "cs.ATG" 
				newType.Name = t.val; 
				if (la.kind == 23) {
					TypeParameterList(
#line  440 "cs.ATG" 
templates);
				}
				if (la.kind == 9) {
					InterfaceBase(
#line  442 "cs.ATG" 
out names);

#line  442 "cs.ATG" 
					newType.BaseTypes = names; 
				}
				while (la.kind == 127) {
					TypeParameterConstraintsClause(
#line  445 "cs.ATG" 
templates);
				}

#line  447 "cs.ATG" 
				newType.BodyStartLocation = t.EndLocation; 
				InterfaceBody();
				if (la.kind == 11) {
					lexer.NextToken();
				}

#line  449 "cs.ATG" 
				newType.EndLocation = t.EndLocation; 
				BlockEnd();
				
			} else if (la.kind == 68) {
				lexer.NextToken();

#line  453 "cs.ATG" 
				TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
				AddChild(newType);
				BlockStart(newType);
				newType.StartLocation = m.GetDeclarationLocation(t.Location);
				newType.Type = Types.Enum;
				
				Identifier();

#line  459 "cs.ATG" 
				newType.Name = t.val; 
				if (la.kind == 9) {
					lexer.NextToken();
					IntegralType(
#line  460 "cs.ATG" 
out name);

#line  460 "cs.ATG" 
					newType.BaseTypes.Add(new TypeReference(name, true)); 
				}

#line  462 "cs.ATG" 
				newType.BodyStartLocation = t.EndLocation; 
				EnumBody();
				if (la.kind == 11) {
					lexer.NextToken();
				}

#line  464 "cs.ATG" 
				newType.EndLocation = t.EndLocation; 
				BlockEnd();
				
			} else {
				lexer.NextToken();

#line  468 "cs.ATG" 
				DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
				templates = delegateDeclr.Templates;
				delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
				
				if (
#line  472 "cs.ATG" 
NotVoidPointer()) {
					Expect(123);

#line  472 "cs.ATG" 
					delegateDeclr.ReturnType = new TypeReference("System.Void", true); 
				} else if (StartOf(10)) {
					Type(
#line  473 "cs.ATG" 
out type);

#line  473 "cs.ATG" 
					delegateDeclr.ReturnType = type; 
				} else SynErr(154);
				Identifier();

#line  475 "cs.ATG" 
				delegateDeclr.Name = t.val; 
				if (la.kind == 23) {
					TypeParameterList(
#line  478 "cs.ATG" 
templates);
				}
				Expect(20);
				if (StartOf(11)) {
					FormalParameterList(
#line  480 "cs.ATG" 
p);

#line  480 "cs.ATG" 
					delegateDeclr.Parameters = p; 
				}
				Expect(21);
				while (la.kind == 127) {
					TypeParameterConstraintsClause(
#line  484 "cs.ATG" 
templates);
				}
				Expect(11);

#line  486 "cs.ATG" 
				delegateDeclr.EndLocation = t.EndLocation;
				AddChild(delegateDeclr);
				
			}
		} else SynErr(155);
	}
 private bool IsMatch(DelegateDeclaration left, DelegateDeclaration right)
 {
     return left.Name == right.Name;
 }
Example #8
0
 public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
 {
     delegateDeclaration.ReturnType.Parent = delegateDeclaration;
     foreach (ParameterDeclarationExpression parameter in delegateDeclaration.Parameters)
         parameter.Parent = delegateDeclaration;
     return base.VisitDelegateDeclaration(delegateDeclaration, data);
 }
		public sealed override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
			this.BeginVisit(delegateDeclaration);
			object result = this.TrackedVisitDelegateDeclaration(delegateDeclaration, data);
			this.EndVisit(delegateDeclaration);
			return result;
		}
 public override object TrackedVisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
 {
     Console.WriteLine("VisitDelegateDeclaration");
     return null;
 }
		void TestDelegateDeclaration(DelegateDeclaration dd)
		{
			Assert.AreEqual("System.Void", dd.ReturnType.Type);
			Assert.AreEqual("MyDelegate", dd.Name);
		}
Example #12
0
	void NonModuleDeclaration(
#line  424 "VBNET.ATG" 
ModifierList m, List<AttributeSection> attributes) {

#line  426 "VBNET.ATG" 
		TypeReference typeRef = null;
		List<TypeReference> baseInterfaces = null;
		
		switch (la.kind) {
		case 71: {

#line  429 "VBNET.ATG" 
			m.Check(Modifiers.Classes); 
			lexer.NextToken();

#line  432 "VBNET.ATG" 
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			newType.StartLocation = t.Location;
			compilationUnit.AddChild(newType);
			compilationUnit.BlockStart(newType);
			
			newType.Type       = ClassType.Class;
			
			Identifier();

#line  439 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
#line  440 "VBNET.ATG" 
newType.Templates);
			EndOfStmt();

#line  442 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			if (la.kind == 127) {
				ClassBaseType(
#line  443 "VBNET.ATG" 
out typeRef);

#line  443 "VBNET.ATG" 
				SafeAdd(newType, newType.BaseTypes, typeRef); 
			}
			while (la.kind == 123) {
				TypeImplementsClause(
#line  444 "VBNET.ATG" 
out baseInterfaces);

#line  444 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces); 
			}
			ClassBody(
#line  445 "VBNET.ATG" 
newType);
			Expect(100);
			Expect(71);

#line  446 "VBNET.ATG" 
			newType.EndLocation = t.EndLocation; 
			EndOfStmt();

#line  449 "VBNET.ATG" 
			compilationUnit.BlockEnd();
			
			break;
		}
		case 141: {
			lexer.NextToken();

#line  453 "VBNET.ATG" 
			m.Check(Modifiers.VBModules);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			compilationUnit.AddChild(newType);
			compilationUnit.BlockStart(newType);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			newType.Type = ClassType.Module;
			
			Identifier();

#line  460 "VBNET.ATG" 
			newType.Name = t.val; 
			EndOfStmt();

#line  462 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			ModuleBody(
#line  463 "VBNET.ATG" 
newType);

#line  465 "VBNET.ATG" 
			compilationUnit.BlockEnd();
			
			break;
		}
		case 194: {
			lexer.NextToken();

#line  469 "VBNET.ATG" 
			m.Check(Modifiers.VBStructures);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			compilationUnit.AddChild(newType);
			compilationUnit.BlockStart(newType);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			newType.Type = ClassType.Struct;
			
			Identifier();

#line  476 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
#line  477 "VBNET.ATG" 
newType.Templates);
			EndOfStmt();

#line  479 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			while (la.kind == 123) {
				TypeImplementsClause(
#line  480 "VBNET.ATG" 
out baseInterfaces);

#line  480 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces);
			}
			StructureBody(
#line  481 "VBNET.ATG" 
newType);

#line  483 "VBNET.ATG" 
			compilationUnit.BlockEnd();
			
			break;
		}
		case 102: {
			lexer.NextToken();

#line  488 "VBNET.ATG" 
			m.Check(Modifiers.VBEnums);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			compilationUnit.AddChild(newType);
			compilationUnit.BlockStart(newType);
			
			newType.Type = ClassType.Enum;
			
			Identifier();

#line  496 "VBNET.ATG" 
			newType.Name = t.val; 
			if (la.kind == 50) {
				lexer.NextToken();
				NonArrayTypeName(
#line  497 "VBNET.ATG" 
out typeRef, false);

#line  497 "VBNET.ATG" 
				SafeAdd(newType, newType.BaseTypes, typeRef); 
			}
			EndOfStmt();

#line  499 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			EnumBody(
#line  500 "VBNET.ATG" 
newType);

#line  502 "VBNET.ATG" 
			compilationUnit.BlockEnd();
			
			break;
		}
		case 129: {
			lexer.NextToken();

#line  507 "VBNET.ATG" 
			m.Check(Modifiers.VBInterfacs);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			compilationUnit.AddChild(newType);
			compilationUnit.BlockStart(newType);
			newType.Type = ClassType.Interface;
			
			Identifier();

#line  514 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
#line  515 "VBNET.ATG" 
newType.Templates);
			EndOfStmt();

#line  517 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			while (la.kind == 127) {
				InterfaceBase(
#line  518 "VBNET.ATG" 
out baseInterfaces);

#line  518 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces); 
			}
			InterfaceBody(
#line  519 "VBNET.ATG" 
newType);

#line  521 "VBNET.ATG" 
			compilationUnit.BlockEnd();
			
			break;
		}
		case 90: {
			lexer.NextToken();

#line  526 "VBNET.ATG" 
			m.Check(Modifiers.VBDelegates);
			DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
			delegateDeclr.ReturnType = new TypeReference("System.Void", true);
			delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
			List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
			
			if (la.kind == 195) {
				lexer.NextToken();
				Identifier();

#line  533 "VBNET.ATG" 
				delegateDeclr.Name = t.val; 
				TypeParameterList(
#line  534 "VBNET.ATG" 
delegateDeclr.Templates);
				if (la.kind == 25) {
					lexer.NextToken();
					if (StartOf(4)) {
						FormalParameterList(
#line  535 "VBNET.ATG" 
p);
					}
					Expect(26);

#line  535 "VBNET.ATG" 
					delegateDeclr.Parameters = p; 
				}
			} else if (la.kind == 114) {
				lexer.NextToken();
				Identifier();

#line  537 "VBNET.ATG" 
				delegateDeclr.Name = t.val; 
				TypeParameterList(
#line  538 "VBNET.ATG" 
delegateDeclr.Templates);
				if (la.kind == 25) {
					lexer.NextToken();
					if (StartOf(4)) {
						FormalParameterList(
#line  539 "VBNET.ATG" 
p);
					}
					Expect(26);

#line  539 "VBNET.ATG" 
					delegateDeclr.Parameters = p; 
				}
				if (la.kind == 50) {
					lexer.NextToken();

#line  540 "VBNET.ATG" 
					TypeReference type; 
					TypeName(
#line  540 "VBNET.ATG" 
out type);

#line  540 "VBNET.ATG" 
					delegateDeclr.ReturnType = type; 
				}
			} else SynErr(231);

#line  542 "VBNET.ATG" 
			delegateDeclr.EndLocation = t.EndLocation; 
			EndOfStmt();

#line  545 "VBNET.ATG" 
			compilationUnit.AddChild(delegateDeclr);
			
			break;
		}
		default: SynErr(232); break;
		}
	}
Example #13
0
	void TypeDecl(
#line  362 "Frames/cs.ATG" 
ModifierList m, List<AttributeSection> attributes) {

#line  364 "Frames/cs.ATG" 
		TypeReference type;
		List<TypeReference> names;
		List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
		string name;
		List<TemplateDefinition> templates;
		
		if (la.kind == 59) {

#line  370 "Frames/cs.ATG" 
			m.Check(Modifiers.Classes); 
			lexer.NextToken();

#line  371 "Frames/cs.ATG" 
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			templates = newType.Templates;
			compilationUnit.AddChild(newType);
			compilationUnit.BlockStart(newType);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			
			newType.Type = Types.Class;
			
			Identifier();

#line  379 "Frames/cs.ATG" 
			newType.Name = t.val; 
			if (la.kind == 23) {
				TypeParameterList(
#line  382 "Frames/cs.ATG" 
templates);
			}
			if (la.kind == 9) {
				ClassBase(
#line  384 "Frames/cs.ATG" 
out names);

#line  384 "Frames/cs.ATG" 
				newType.BaseTypes = names; 
			}
			while (la.kind == 127) {
				TypeParameterConstraintsClause(
#line  387 "Frames/cs.ATG" 
templates);
			}

#line  389 "Frames/cs.ATG" 
			newType.BodyStartLocation = t.EndLocation; 
			Expect(16);
			ClassBody();
			Expect(17);
			if (la.kind == 11) {
				lexer.NextToken();
			}

#line  393 "Frames/cs.ATG" 
			newType.EndLocation = t.EndLocation; 
			compilationUnit.BlockEnd();
			
		} else if (StartOf(9)) {

#line  396 "Frames/cs.ATG" 
			m.Check(Modifiers.StructsInterfacesEnumsDelegates); 
			if (la.kind == 109) {
				lexer.NextToken();

#line  397 "Frames/cs.ATG" 
				TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
				templates = newType.Templates;
				newType.StartLocation = m.GetDeclarationLocation(t.Location);
				compilationUnit.AddChild(newType);
				compilationUnit.BlockStart(newType);
				newType.Type = Types.Struct; 
				
				Identifier();

#line  404 "Frames/cs.ATG" 
				newType.Name = t.val; 
				if (la.kind == 23) {
					TypeParameterList(
#line  407 "Frames/cs.ATG" 
templates);
				}
				if (la.kind == 9) {
					StructInterfaces(
#line  409 "Frames/cs.ATG" 
out names);

#line  409 "Frames/cs.ATG" 
					newType.BaseTypes = names; 
				}
				while (la.kind == 127) {
					TypeParameterConstraintsClause(
#line  412 "Frames/cs.ATG" 
templates);
				}

#line  415 "Frames/cs.ATG" 
				newType.BodyStartLocation = t.EndLocation; 
				StructBody();
				if (la.kind == 11) {
					lexer.NextToken();
				}

#line  417 "Frames/cs.ATG" 
				newType.EndLocation = t.EndLocation; 
				compilationUnit.BlockEnd();
				
			} else if (la.kind == 83) {
				lexer.NextToken();

#line  421 "Frames/cs.ATG" 
				TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
				templates = newType.Templates;
				compilationUnit.AddChild(newType);
				compilationUnit.BlockStart(newType);
				newType.StartLocation = m.GetDeclarationLocation(t.Location);
				newType.Type = Types.Interface;
				
				Identifier();

#line  428 "Frames/cs.ATG" 
				newType.Name = t.val; 
				if (la.kind == 23) {
					TypeParameterList(
#line  431 "Frames/cs.ATG" 
templates);
				}
				if (la.kind == 9) {
					InterfaceBase(
#line  433 "Frames/cs.ATG" 
out names);

#line  433 "Frames/cs.ATG" 
					newType.BaseTypes = names; 
				}
				while (la.kind == 127) {
					TypeParameterConstraintsClause(
#line  436 "Frames/cs.ATG" 
templates);
				}

#line  438 "Frames/cs.ATG" 
				newType.BodyStartLocation = t.EndLocation; 
				InterfaceBody();
				if (la.kind == 11) {
					lexer.NextToken();
				}

#line  440 "Frames/cs.ATG" 
				newType.EndLocation = t.EndLocation; 
				compilationUnit.BlockEnd();
				
			} else if (la.kind == 68) {
				lexer.NextToken();

#line  444 "Frames/cs.ATG" 
				TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
				compilationUnit.AddChild(newType);
				compilationUnit.BlockStart(newType);
				newType.StartLocation = m.GetDeclarationLocation(t.Location);
				newType.Type = Types.Enum;
				
				Identifier();

#line  450 "Frames/cs.ATG" 
				newType.Name = t.val; 
				if (la.kind == 9) {
					lexer.NextToken();
					IntegralType(
#line  451 "Frames/cs.ATG" 
out name);

#line  451 "Frames/cs.ATG" 
					newType.BaseTypes.Add(new TypeReference(name, true)); 
				}

#line  453 "Frames/cs.ATG" 
				newType.BodyStartLocation = t.EndLocation; 
				EnumBody();
				if (la.kind == 11) {
					lexer.NextToken();
				}

#line  455 "Frames/cs.ATG" 
				newType.EndLocation = t.EndLocation; 
				compilationUnit.BlockEnd();
				
			} else {
				lexer.NextToken();

#line  459 "Frames/cs.ATG" 
				DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
				templates = delegateDeclr.Templates;
				delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
				
				if (
#line  463 "Frames/cs.ATG" 
NotVoidPointer()) {
					Expect(123);

#line  463 "Frames/cs.ATG" 
					delegateDeclr.ReturnType = new TypeReference("System.Void", true); 
				} else if (StartOf(10)) {
					Type(
#line  464 "Frames/cs.ATG" 
out type);

#line  464 "Frames/cs.ATG" 
					delegateDeclr.ReturnType = type; 
				} else SynErr(152);
				Identifier();

#line  466 "Frames/cs.ATG" 
				delegateDeclr.Name = t.val; 
				if (la.kind == 23) {
					TypeParameterList(
#line  469 "Frames/cs.ATG" 
templates);
				}
				Expect(20);
				if (StartOf(11)) {
					FormalParameterList(
#line  471 "Frames/cs.ATG" 
p);

#line  471 "Frames/cs.ATG" 
					delegateDeclr.Parameters = p; 
				}
				Expect(21);
				while (la.kind == 127) {
					TypeParameterConstraintsClause(
#line  475 "Frames/cs.ATG" 
templates);
				}
				Expect(11);

#line  477 "Frames/cs.ATG" 
				delegateDeclr.EndLocation = t.EndLocation;
				compilationUnit.AddChild(delegateDeclr);
				
			}
		} else SynErr(153);
	}
			public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
			{
				HandleTypeDeclaration(delegateDeclaration);
				return null;
			}
		public virtual object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
			Debug.Assert((delegateDeclaration != null));
			Debug.Assert((delegateDeclaration.Attributes != null));
			Debug.Assert((delegateDeclaration.ReturnType != null));
			Debug.Assert((delegateDeclaration.Parameters != null));
			Debug.Assert((delegateDeclaration.Templates != null));
			for (int i = 0; i < delegateDeclaration.Attributes.Count; i++) {
				AttributeSection o = delegateDeclaration.Attributes[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (AttributeSection)nodeStack.Pop();
				if (o == null)
					delegateDeclaration.Attributes.RemoveAt(i--);
				else
					delegateDeclaration.Attributes[i] = o;
			}
			nodeStack.Push(delegateDeclaration.ReturnType);
			delegateDeclaration.ReturnType.AcceptVisitor(this, data);
			delegateDeclaration.ReturnType = ((TypeReference)(nodeStack.Pop()));
			for (int i = 0; i < delegateDeclaration.Parameters.Count; i++) {
				ParameterDeclarationExpression o = delegateDeclaration.Parameters[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (ParameterDeclarationExpression)nodeStack.Pop();
				if (o == null)
					delegateDeclaration.Parameters.RemoveAt(i--);
				else
					delegateDeclaration.Parameters[i] = o;
			}
			for (int i = 0; i < delegateDeclaration.Templates.Count; i++) {
				TemplateDefinition o = delegateDeclaration.Templates[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (TemplateDefinition)nodeStack.Pop();
				if (o == null)
					delegateDeclaration.Templates.RemoveAt(i--);
				else
					delegateDeclaration.Templates[i] = o;
			}
			return null;
		}
Example #16
0
 public virtual object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
     throw CreateException(delegateDeclaration);
 }
		public object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
		{
			B.CallableDefinition cd = new B.CallableDefinition(GetLexicalInfo(delegateDeclaration));
			cd.Name = delegateDeclaration.Name;
			ConvertAttributes(delegateDeclaration.Attributes, cd.Attributes);
			cd.Modifiers = ConvertModifier(delegateDeclaration, B.TypeMemberModifiers.Private);
			ConvertParameters(delegateDeclaration.Parameters, cd.Parameters);
			cd.ReturnType = ConvertTypeReference(delegateDeclaration.ReturnType);
			if (currentType != null)
				currentType.Members.Add(cd);
			else
				module.Members.Add(cd);
			return cd;
		}
Example #18
0
 public virtual object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
 {
     Debug.Assert((delegateDeclaration != null));
     Debug.Assert((delegateDeclaration.Attributes != null));
     Debug.Assert((delegateDeclaration.ReturnType != null));
     Debug.Assert((delegateDeclaration.Parameters != null));
     Debug.Assert((delegateDeclaration.Templates != null));
     foreach (AttributeSection o in delegateDeclaration.Attributes) {
         Debug.Assert(o != null);
         o.AcceptVisitor(this, data);
     }
     delegateDeclaration.ReturnType.AcceptVisitor(this, data);
     foreach (ParameterDeclarationExpression o in delegateDeclaration.Parameters) {
         Debug.Assert(o != null);
         o.AcceptVisitor(this, data);
     }
     foreach (TemplateDefinition o in delegateDeclaration.Templates) {
         Debug.Assert(o != null);
         o.AcceptVisitor(this, data);
     }
     return null;
 }
 public object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
 {
     throw new NotImplementedException ();
 }
 public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
 {
     if (this.CheckNode(delegateDeclaration)) {
         return null;
     }
     return base.VisitDelegateDeclaration(delegateDeclaration, data);
 }
Example #21
0
	void NonModuleDeclaration(
#line  459 "VBNET.ATG" 
ModifierList m, List<AttributeSection> attributes) {

#line  461 "VBNET.ATG" 
		TypeReference typeRef = null;
		List<TypeReference> baseInterfaces = null;
		
		switch (la.kind) {
		case 86: {

#line  464 "VBNET.ATG" 
			m.Check(Modifiers.Classes); 
			lexer.NextToken();

#line  467 "VBNET.ATG" 
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			newType.StartLocation = t.Location;
			AddChild(newType);
			BlockStart(newType);
			
			newType.Type       = ClassType.Class;
			
			Identifier();

#line  474 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
#line  475 "VBNET.ATG" 
newType.Templates);
			EndOfStmt();

#line  477 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			if (la.kind == 142) {
				ClassBaseType(
#line  478 "VBNET.ATG" 
out typeRef);

#line  478 "VBNET.ATG" 
				SafeAdd(newType, newType.BaseTypes, typeRef); 
			}
			while (la.kind == 138) {
				TypeImplementsClause(
#line  479 "VBNET.ATG" 
out baseInterfaces);

#line  479 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces); 
			}
			ClassBody(
#line  480 "VBNET.ATG" 
newType);
			Expect(115);
			Expect(86);

#line  481 "VBNET.ATG" 
			newType.EndLocation = t.EndLocation; 
			EndOfStmt();

#line  484 "VBNET.ATG" 
			BlockEnd();
			
			break;
		}
		case 158: {
			lexer.NextToken();

#line  488 "VBNET.ATG" 
			m.Check(Modifiers.VBModules);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			AddChild(newType);
			BlockStart(newType);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			newType.Type = ClassType.Module;
			
			Identifier();

#line  495 "VBNET.ATG" 
			newType.Name = t.val; 
			EndOfStmt();

#line  497 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			ModuleBody(
#line  498 "VBNET.ATG" 
newType);

#line  500 "VBNET.ATG" 
			BlockEnd();
			
			break;
		}
		case 212: {
			lexer.NextToken();

#line  504 "VBNET.ATG" 
			m.Check(Modifiers.VBStructures);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			AddChild(newType);
			BlockStart(newType);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			newType.Type = ClassType.Struct;
			
			Identifier();

#line  511 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
#line  512 "VBNET.ATG" 
newType.Templates);
			EndOfStmt();

#line  514 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			while (la.kind == 138) {
				TypeImplementsClause(
#line  515 "VBNET.ATG" 
out baseInterfaces);

#line  515 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces);
			}
			StructureBody(
#line  516 "VBNET.ATG" 
newType);

#line  518 "VBNET.ATG" 
			BlockEnd();
			
			break;
		}
		case 117: {
			lexer.NextToken();

#line  523 "VBNET.ATG" 
			m.Check(Modifiers.VBEnums);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			AddChild(newType);
			BlockStart(newType);
			
			newType.Type = ClassType.Enum;
			
			Identifier();

#line  531 "VBNET.ATG" 
			newType.Name = t.val; 
			if (la.kind == 63) {
				lexer.NextToken();
				NonArrayTypeName(
#line  532 "VBNET.ATG" 
out typeRef, false);

#line  532 "VBNET.ATG" 
				SafeAdd(newType, newType.BaseTypes, typeRef); 
			}
			EndOfStmt();

#line  534 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			EnumBody(
#line  535 "VBNET.ATG" 
newType);

#line  537 "VBNET.ATG" 
			BlockEnd();
			
			break;
		}
		case 144: {
			lexer.NextToken();

#line  542 "VBNET.ATG" 
			m.Check(Modifiers.VBInterfacs);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			AddChild(newType);
			BlockStart(newType);
			newType.Type = ClassType.Interface;
			
			Identifier();

#line  549 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
#line  550 "VBNET.ATG" 
newType.Templates);
			EndOfStmt();

#line  552 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			while (la.kind == 142) {
				InterfaceBase(
#line  553 "VBNET.ATG" 
out baseInterfaces);

#line  553 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces); 
			}
			InterfaceBody(
#line  554 "VBNET.ATG" 
newType);

#line  556 "VBNET.ATG" 
			BlockEnd();
			
			break;
		}
		case 105: {
			lexer.NextToken();

#line  561 "VBNET.ATG" 
			m.Check(Modifiers.VBDelegates);
			DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
			delegateDeclr.ReturnType = new TypeReference("System.Void", true);
			delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
			List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
			
			if (la.kind == 213) {
				lexer.NextToken();
				Identifier();

#line  568 "VBNET.ATG" 
				delegateDeclr.Name = t.val; 
				TypeParameterList(
#line  569 "VBNET.ATG" 
delegateDeclr.Templates);
				if (la.kind == 37) {
					lexer.NextToken();
					if (StartOf(6)) {
						FormalParameterList(
#line  570 "VBNET.ATG" 
p);
					}
					Expect(38);

#line  570 "VBNET.ATG" 
					delegateDeclr.Parameters = p; 
				}
			} else if (la.kind == 129) {
				lexer.NextToken();
				Identifier();

#line  572 "VBNET.ATG" 
				delegateDeclr.Name = t.val; 
				TypeParameterList(
#line  573 "VBNET.ATG" 
delegateDeclr.Templates);
				if (la.kind == 37) {
					lexer.NextToken();
					if (StartOf(6)) {
						FormalParameterList(
#line  574 "VBNET.ATG" 
p);
					}
					Expect(38);

#line  574 "VBNET.ATG" 
					delegateDeclr.Parameters = p; 
				}
				if (la.kind == 63) {
					lexer.NextToken();

#line  575 "VBNET.ATG" 
					TypeReference type; 
					TypeName(
#line  575 "VBNET.ATG" 
out type);

#line  575 "VBNET.ATG" 
					delegateDeclr.ReturnType = type; 
				}
			} else SynErr(254);

#line  577 "VBNET.ATG" 
			delegateDeclr.EndLocation = t.EndLocation; 
			EndOfStmt();

#line  580 "VBNET.ATG" 
			AddChild(delegateDeclr);
			
			break;
		}
		default: SynErr(255); break;
		}
	}
Example #22
0
		public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
		{
			// fix default inner type visibility
			if (currentType != null && (delegateDeclaration.Modifier & Modifiers.Visibility) == 0)
				delegateDeclaration.Modifier |= Modifiers.Private;
			
			return base.VisitDelegateDeclaration(delegateDeclaration, data);
		}
Example #23
0
        public override object VisitDelegateDeclaration (DelegateDeclaration node, object data)
        {
            if (CurrentType == null)
            {
                return null;
            }
            bool isStatic = HasModifier (node.Modifier, Modifiers.Static);
            IDictionary<string, DelegateDeclaration> dict = isStatic ? CurrentType.StaticDelegates : CurrentType.InstanceDelegates;
            
            var key = GenericsHelper.GetScriptName (node);

            if (dict.ContainsKey (key)) {
                Console.WriteLine ("Overloads are not allowed");
                //throw CreateException (node, "Overloads are not allowed");
            } else {
                dict.Add (key, node);
            }
            return null;
        }
		public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
		{
//			CodeTypeDelegate codeTypeDelegate = new CodeTypeDelegate(delegateDeclaration.Name);
//			codeTypeDelegate.Parameters
//
//			((CodeNamespace)namespaceDeclarations.Peek()).Types.Add(codeTypeDelegate);
			return null;
		}
Example #25
0
        public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
        {
            CodeTypeDelegate codeTypeDelegate = new CodeTypeDelegate(delegateDeclaration.Name);
            codeTypeDelegate.Attributes = ConvMemberAttributes(delegateDeclaration.Modifier);
            codeTypeDelegate.ReturnType = ConvType(delegateDeclaration.ReturnType);

            foreach (ParameterDeclarationExpression parameter in delegateDeclaration.Parameters)
            {
                codeTypeDelegate.Parameters.Add((CodeParameterDeclarationExpression)VisitParameterDeclarationExpression(parameter, data));
            }

            if (typeDeclarations.Count > 0)
            {
                typeDeclarations.Peek().Members.Add(codeTypeDelegate);
            }
            else
            {
                namespaceDeclarations.Peek().Types.Add(codeTypeDelegate);
            }

            return null;
        }
Example #26
0
		public virtual object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
			throw new global::System.NotImplementedException("DelegateDeclaration");
		}
 public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
 {
     UnlockWith(delegateDeclaration);
     return base.VisitDelegateDeclaration(delegateDeclaration, data);
 }
		public virtual object TrackedVisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
			return base.VisitDelegateDeclaration(delegateDeclaration, data);
		}
Example #29
0
	void NonModuleDeclaration(
#line  405 "VBNET.ATG" 
ModifierList m, List<AttributeSection> attributes) {

#line  407 "VBNET.ATG" 
		TypeReference typeRef = null;
		List<TypeReference> baseInterfaces = null;
		
		switch (la.kind) {
		case 67: {

#line  410 "VBNET.ATG" 
			m.Check(Modifiers.Classes); 
			lexer.NextToken();

#line  413 "VBNET.ATG" 
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			newType.StartLocation = t.Location;
			compilationUnit.AddChild(newType);
			compilationUnit.BlockStart(newType);
			
			newType.Type       = ClassType.Class;
			
			Identifier();

#line  420 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
#line  421 "VBNET.ATG" 
newType.Templates);
			EndOfStmt();

#line  423 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			if (la.kind == 110) {
				ClassBaseType(
#line  424 "VBNET.ATG" 
out typeRef);

#line  424 "VBNET.ATG" 
				newType.BaseTypes.Add(typeRef); 
			}
			while (la.kind == 107) {
				TypeImplementsClause(
#line  425 "VBNET.ATG" 
out baseInterfaces);

#line  425 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces); 
			}
			ClassBody(
#line  426 "VBNET.ATG" 
newType);
			Expect(88);
			Expect(67);

#line  427 "VBNET.ATG" 
			newType.EndLocation = t.EndLocation; 
			Expect(1);

#line  430 "VBNET.ATG" 
			compilationUnit.BlockEnd();
			
			break;
		}
		case 121: {
			lexer.NextToken();

#line  434 "VBNET.ATG" 
			m.Check(Modifiers.VBModules);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			compilationUnit.AddChild(newType);
			compilationUnit.BlockStart(newType);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			newType.Type = ClassType.Module;
			
			Identifier();

#line  441 "VBNET.ATG" 
			newType.Name = t.val; 
			Expect(1);

#line  443 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			ModuleBody(
#line  444 "VBNET.ATG" 
newType);

#line  446 "VBNET.ATG" 
			compilationUnit.BlockEnd();
			
			break;
		}
		case 166: {
			lexer.NextToken();

#line  450 "VBNET.ATG" 
			m.Check(Modifiers.VBStructures);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			compilationUnit.AddChild(newType);
			compilationUnit.BlockStart(newType);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			newType.Type = ClassType.Struct;
			
			Identifier();

#line  457 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
#line  458 "VBNET.ATG" 
newType.Templates);
			Expect(1);

#line  460 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			while (la.kind == 107) {
				TypeImplementsClause(
#line  461 "VBNET.ATG" 
out baseInterfaces);

#line  461 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces);
			}
			StructureBody(
#line  462 "VBNET.ATG" 
newType);

#line  464 "VBNET.ATG" 
			compilationUnit.BlockEnd();
			
			break;
		}
		case 90: {
			lexer.NextToken();

#line  469 "VBNET.ATG" 
			m.Check(Modifiers.VBEnums);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			compilationUnit.AddChild(newType);
			compilationUnit.BlockStart(newType);
			
			newType.Type = ClassType.Enum;
			
			Identifier();

#line  477 "VBNET.ATG" 
			newType.Name = t.val; 
			if (la.kind == 48) {
				lexer.NextToken();
				NonArrayTypeName(
#line  478 "VBNET.ATG" 
out typeRef, false);

#line  478 "VBNET.ATG" 
				newType.BaseTypes.Add(typeRef); 
			}
			Expect(1);

#line  480 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			EnumBody(
#line  481 "VBNET.ATG" 
newType);

#line  483 "VBNET.ATG" 
			compilationUnit.BlockEnd();
			
			break;
		}
		case 112: {
			lexer.NextToken();

#line  488 "VBNET.ATG" 
			m.Check(Modifiers.VBInterfacs);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			compilationUnit.AddChild(newType);
			compilationUnit.BlockStart(newType);
			newType.Type = ClassType.Interface;
			
			Identifier();

#line  495 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
#line  496 "VBNET.ATG" 
newType.Templates);
			EndOfStmt();

#line  498 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			while (la.kind == 110) {
				InterfaceBase(
#line  499 "VBNET.ATG" 
out baseInterfaces);

#line  499 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces); 
			}
			InterfaceBody(
#line  500 "VBNET.ATG" 
newType);

#line  502 "VBNET.ATG" 
			compilationUnit.BlockEnd();
			
			break;
		}
		case 80: {
			lexer.NextToken();

#line  507 "VBNET.ATG" 
			m.Check(Modifiers.VBDelegates);
			DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
			delegateDeclr.ReturnType = new TypeReference("", "System.Void");
			delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
			List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
			
			if (la.kind == 167) {
				lexer.NextToken();
				Identifier();

#line  514 "VBNET.ATG" 
				delegateDeclr.Name = t.val; 
				TypeParameterList(
#line  515 "VBNET.ATG" 
delegateDeclr.Templates);
				if (la.kind == 24) {
					lexer.NextToken();
					if (StartOf(4)) {
						FormalParameterList(
#line  516 "VBNET.ATG" 
p);
					}
					Expect(25);

#line  516 "VBNET.ATG" 
					delegateDeclr.Parameters = p; 
				}
			} else if (la.kind == 100) {
				lexer.NextToken();
				Identifier();

#line  518 "VBNET.ATG" 
				delegateDeclr.Name = t.val; 
				TypeParameterList(
#line  519 "VBNET.ATG" 
delegateDeclr.Templates);
				if (la.kind == 24) {
					lexer.NextToken();
					if (StartOf(4)) {
						FormalParameterList(
#line  520 "VBNET.ATG" 
p);
					}
					Expect(25);

#line  520 "VBNET.ATG" 
					delegateDeclr.Parameters = p; 
				}
				if (la.kind == 48) {
					lexer.NextToken();

#line  521 "VBNET.ATG" 
					TypeReference type; 
					TypeName(
#line  521 "VBNET.ATG" 
out type);

#line  521 "VBNET.ATG" 
					delegateDeclr.ReturnType = type; 
				}
			} else SynErr(215);

#line  523 "VBNET.ATG" 
			delegateDeclr.EndLocation = t.EndLocation; 
			Expect(1);

#line  526 "VBNET.ATG" 
			compilationUnit.AddChild(delegateDeclr);
			
			break;
		}
		default: SynErr(216); break;
		}
	}
Example #30
0
	void NonModuleDeclaration(
//#line  455 "VBNET.ATG" 
ModifierList m, List<AttributeSection> attributes) {

//#line  457 "VBNET.ATG" 
		TypeReference typeRef = null;
		List<TypeReference> baseInterfaces = null;
		
		switch (la.kind) {
		case 84: {

//#line  460 "VBNET.ATG" 
			m.Check(Modifiers.Classes); 
			lexer.NextToken();

//#line  463 "VBNET.ATG" 
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			newType.StartLocation = t.Location;
			AddChild(newType);
			BlockStart(newType);
			
			newType.Type       = ClassType.Class;
			
			Identifier();

//#line  470 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
//#line  471 "VBNET.ATG" 
newType.Templates);
			EndOfStmt();

//#line  473 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			if (la.kind == 140) {
				ClassBaseType(
//#line  474 "VBNET.ATG" 
out typeRef);

//#line  474 "VBNET.ATG" 
				SafeAdd(newType, newType.BaseTypes, typeRef); 
			}
			while (la.kind == 136) {
				TypeImplementsClause(
//#line  475 "VBNET.ATG" 
out baseInterfaces);

//#line  475 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces); 
			}
			ClassBody(
//#line  476 "VBNET.ATG" 
newType);
			Expect(113);
			Expect(84);

//#line  477 "VBNET.ATG" 
			newType.EndLocation = t.EndLocation; 
			EndOfStmt();

//#line  480 "VBNET.ATG" 
			BlockEnd();
			
			break;
		}
		case 155: {
			lexer.NextToken();

//#line  484 "VBNET.ATG" 
			m.Check(Modifiers.VBModules);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			AddChild(newType);
			BlockStart(newType);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			newType.Type = ClassType.Module;
			
			Identifier();

//#line  491 "VBNET.ATG" 
			newType.Name = t.val; 
			EndOfStmt();

//#line  493 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			ModuleBody(
//#line  494 "VBNET.ATG" 
newType);

//#line  496 "VBNET.ATG" 
			BlockEnd();
			
			break;
		}
		case 209: {
			lexer.NextToken();

//#line  500 "VBNET.ATG" 
			m.Check(Modifiers.VBStructures);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			AddChild(newType);
			BlockStart(newType);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			newType.Type = ClassType.Struct;
			
			Identifier();

//#line  507 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
//#line  508 "VBNET.ATG" 
newType.Templates);
			EndOfStmt();

//#line  510 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			while (la.kind == 136) {
				TypeImplementsClause(
//#line  511 "VBNET.ATG" 
out baseInterfaces);

//#line  511 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces);
			}
			StructureBody(
//#line  512 "VBNET.ATG" 
newType);

//#line  514 "VBNET.ATG" 
			BlockEnd();
			
			break;
		}
		case 115: {
			lexer.NextToken();

//#line  519 "VBNET.ATG" 
			m.Check(Modifiers.VBEnums);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			AddChild(newType);
			BlockStart(newType);
			
			newType.Type = ClassType.Enum;
			
			Identifier();

//#line  527 "VBNET.ATG" 
			newType.Name = t.val; 
			if (la.kind == 63) {
				lexer.NextToken();
				NonArrayTypeName(
//#line  528 "VBNET.ATG" 
out typeRef, false);

//#line  528 "VBNET.ATG" 
				SafeAdd(newType, newType.BaseTypes, typeRef); 
			}
			EndOfStmt();

//#line  530 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			EnumBody(
//#line  531 "VBNET.ATG" 
newType);

//#line  533 "VBNET.ATG" 
			BlockEnd();
			
			break;
		}
		case 142: {
			lexer.NextToken();

//#line  538 "VBNET.ATG" 
			m.Check(Modifiers.VBInterfacs);
			TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
			newType.StartLocation = m.GetDeclarationLocation(t.Location);
			AddChild(newType);
			BlockStart(newType);
			newType.Type = ClassType.Interface;
			
			Identifier();

//#line  545 "VBNET.ATG" 
			newType.Name = t.val; 
			TypeParameterList(
//#line  546 "VBNET.ATG" 
newType.Templates);
			EndOfStmt();

//#line  548 "VBNET.ATG" 
			newType.BodyStartLocation = t.Location; 
			while (la.kind == 140) {
				InterfaceBase(
//#line  549 "VBNET.ATG" 
out baseInterfaces);

//#line  549 "VBNET.ATG" 
				newType.BaseTypes.AddRange(baseInterfaces); 
			}
			InterfaceBody(
//#line  550 "VBNET.ATG" 
newType);

//#line  552 "VBNET.ATG" 
			BlockEnd();
			
			break;
		}
		case 103: {
			lexer.NextToken();

//#line  557 "VBNET.ATG" 
			m.Check(Modifiers.VBDelegates);
			DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
			delegateDeclr.ReturnType = new TypeReference("System.Void", true);
			delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
			List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
			
			if (la.kind == 210) {
				lexer.NextToken();
				Identifier();

//#line  564 "VBNET.ATG" 
				delegateDeclr.Name = t.val; 
				TypeParameterList(
//#line  565 "VBNET.ATG" 
delegateDeclr.Templates);
				if (la.kind == 37) {
					lexer.NextToken();
					if (StartOf(6)) {
						FormalParameterList(
//#line  566 "VBNET.ATG" 
p);
					}
					Expect(38);

//#line  566 "VBNET.ATG" 
					delegateDeclr.Parameters = p; 
				}
			} else if (la.kind == 127) {
				lexer.NextToken();
				Identifier();

//#line  568 "VBNET.ATG" 
				delegateDeclr.Name = t.val; 
				TypeParameterList(
//#line  569 "VBNET.ATG" 
delegateDeclr.Templates);
				if (la.kind == 37) {
					lexer.NextToken();
					if (StartOf(6)) {
						FormalParameterList(
//#line  570 "VBNET.ATG" 
p);
					}
					Expect(38);

//#line  570 "VBNET.ATG" 
					delegateDeclr.Parameters = p; 
				}
				if (la.kind == 63) {
					lexer.NextToken();

//#line  571 "VBNET.ATG" 
					TypeReference type; 
					TypeName(
//#line  571 "VBNET.ATG" 
out type);

//#line  571 "VBNET.ATG" 
					delegateDeclr.ReturnType = type; 
				}
			} else SynErr(250);

//#line  573 "VBNET.ATG" 
			delegateDeclr.EndLocation = t.EndLocation; 
			EndOfStmt();

//#line  576 "VBNET.ATG" 
			AddChild(delegateDeclr);
			
			break;
		}
		default: SynErr(251); break;
		}
	}
 public virtual bool VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object d)
 {
     if ((delegateDeclaration == null)) {
         return SetFailure();
     }
     if ((d == null)) {
         return SetFailure();
     }
     if ((delegateDeclaration.Attributes == null)) {
         return SetFailure();
     }
     if ((delegateDeclaration.ReturnType == null)) {
         return SetFailure();
     }
     if ((delegateDeclaration.Parameters == null)) {
         return SetFailure();
     }
     if ((delegateDeclaration.Templates == null)) {
         return SetFailure();
     }
     if(delegateDeclaration.GetType() != d.GetType()) {return SetFailure();}
     var data = (DelegateDeclaration)d;
     if (!IsMatch(delegateDeclaration, data)) {
         return SetFailure();
     }
     if (delegateDeclaration.Attributes.Count == data.Attributes.Count) {
     for (int i=0; i<delegateDeclaration.Attributes.Count;i++) {
         AttributeSection o = delegateDeclaration.Attributes[i];
         if(o == null){return SetFailure();}
         if((bool)o.AcceptVisitor(this, data.Attributes[i]) == false) return SetFailure();
     }			}			else { return SetFailure(); }
     delegateDeclaration.ReturnType.AcceptVisitor(this, data.ReturnType);
     if (delegateDeclaration.Parameters.Count == data.Parameters.Count) {
     for (int i=0; i<delegateDeclaration.Parameters.Count;i++) {
         ParameterDeclarationExpression o = delegateDeclaration.Parameters[i];
         if(o == null){return SetFailure();}
         if((bool)o.AcceptVisitor(this, data.Parameters[i]) == false) return SetFailure();
     }			}			else { return SetFailure(); }
     if (delegateDeclaration.Templates.Count == data.Templates.Count) {
     for (int i=0; i<delegateDeclaration.Templates.Count;i++) {
         TemplateDefinition o = delegateDeclaration.Templates[i];
         if(o == null){return SetFailure();}
         if((bool)o.AcceptVisitor(this, data.Templates[i]) == false) return SetFailure();
     }			}			else { return SetFailure(); }
     return true;
 }