public override object Visit(DelegateDeclaration delegateDeclaration, object data)
 {
     //			CodeTypeDelegate codeTypeDelegate = new CodeTypeDelegate(delegateDeclaration.Name);
     //			codeTypeDelegate.Parameters
     //
     //			((CodeNamespace)namespaceDeclarations.Peek()).Types.Add(codeTypeDelegate);
     return null;
 }
        public override object Visit(DelegateDeclaration delegateDeclaration, object data)
        {
            DebugOutput(delegateDeclaration);
            AppendNewLine();
            AppendAttributes(delegateDeclaration.Attributes);
            AppendIndentation();sourceText.Append(GetModifier(delegateDeclaration.Modifier));
            sourceText.Append("Delegate ");
            bool isFunction = (delegateDeclaration.ReturnType.Type != "void");
            if (isFunction) {
                sourceText.Append("Function ");
            } else {
                sourceText.Append("Sub ");
            }

            sourceText.Append(delegateDeclaration.Name);
            sourceText.Append("(");
            AppendParameters(delegateDeclaration.Parameters);
            sourceText.Append(")");
            if (isFunction) {
                sourceText.Append(" As ");
                sourceText.Append(GetTypeString(delegateDeclaration.ReturnType));
            }
            AppendNewLine();
            return null;
        }
 public override object Visit(DelegateDeclaration delegateDeclaration, object data)
 {
     Console.WriteLine(delegateDeclaration.ToString());
     return delegateDeclaration.AcceptChildren(this, data);
 }
 public virtual object Visit(DelegateDeclaration delegateDeclaration, object data)
 {
     foreach (AttributeSection section in delegateDeclaration.Attributes) {
         section.AcceptVisitor(this, data);
     }
     foreach (ParameterDeclarationExpression p in delegateDeclaration.Parameters) {
         p.AcceptVisitor(this, data);
     }
     return data;
 }
Example #5
0
	void TypeDecl(
#line  691 "cs.ATG" 
Modifiers m, ArrayList attributes, bool partial) {

#line  693 "cs.ATG" 
		TypeReference type;
		StringCollection names;
		ArrayList p; string name;
		
		if (la.kind == 58) {

#line  697 "cs.ATG" 
			m.Check(Modifier.Classes); 
			lexer.NextToken();

#line  698 "cs.ATG" 
			TypeDeclaration newType = new TypeDeclaration (partial);
			compilationUnit.AddChild(newType);
			compilationUnit.BlockStart(newType);
			
			newType.Type = Types.Class;
			newType.Modifier = m.Modifier;
			newType.Attributes = attributes;
			
			Expect(1);

#line  706 "cs.ATG" 
			newType.Name = t.val; 
			if (la.kind == 9) {
				ClassBase(
#line  707 "cs.ATG" 
out names);

#line  707 "cs.ATG" 
				newType.BaseTypes = names; 
			}

#line  707 "cs.ATG" 
			newType.StartLocation = t.EndLocation; 
			ClassBody();
			if (la.kind == 10) {
				lexer.NextToken();
			}

#line  709 "cs.ATG" 
			newType.EndLocation = t.Location; 
			compilationUnit.BlockEnd();
			
		} else if (StartOf(7)) {

#line  712 "cs.ATG" 
			m.Check(Modifier.StructsInterfacesEnumsDelegates); 
			if (la.kind == 108) {
				lexer.NextToken();

#line  713 "cs.ATG" 
				TypeDeclaration newType = new TypeDeclaration(partial);
				compilationUnit.AddChild(newType);
				compilationUnit.BlockStart(newType);
				newType.Type = Types.Struct; 
				newType.Modifier = m.Modifier;
				newType.Attributes = attributes;
				
				Expect(1);

#line  720 "cs.ATG" 
				newType.Name = t.val; 
				if (la.kind == 9) {
					StructInterfaces(
#line  721 "cs.ATG" 
out names);

#line  721 "cs.ATG" 
					newType.BaseTypes = names; 
				}

#line  721 "cs.ATG" 
				newType.StartLocation = t.EndLocation; 
				StructBody();
				if (la.kind == 10) {
					lexer.NextToken();
				}

#line  723 "cs.ATG" 
				newType.EndLocation = t.Location; 
				compilationUnit.BlockEnd();
				
			} else if (la.kind == 82) {
				lexer.NextToken();

#line  727 "cs.ATG" 
				TypeDeclaration newType = new TypeDeclaration(partial);
				compilationUnit.AddChild(newType);
				compilationUnit.BlockStart(newType);
				newType.Type = Types.Interface;
				newType.Attributes = attributes;
				newType.Modifier = m.Modifier;
				Expect(1);

#line  733 "cs.ATG" 
				newType.Name = t.val; 
				if (la.kind == 9) {
					InterfaceBase(
#line  734 "cs.ATG" 
out names);

#line  734 "cs.ATG" 
					newType.BaseTypes = names; 
				}

#line  734 "cs.ATG" 
				newType.StartLocation = t.EndLocation; 
				InterfaceBody();
				if (la.kind == 10) {
					lexer.NextToken();
				}

#line  736 "cs.ATG" 
				newType.EndLocation = t.Location; 
				compilationUnit.BlockEnd();
				
			} else if (la.kind == 67) {
				lexer.NextToken();

#line  740 "cs.ATG" 
				if (partial) Error ("partial is not allowed for enum types");
				TypeDeclaration newType = new TypeDeclaration();
				                           compilationUnit.AddChild(newType);
				                           compilationUnit.BlockStart(newType);
				                           newType.Type = Types.Enum;
				                           newType.Attributes = attributes;
				                           newType.Modifier = m.Modifier;
				Expect(1);

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

#line  748 "cs.ATG" 
					newType.BaseTypes = new StringCollection(); 
					newType.BaseTypes.Add(name);
					
				}

#line  751 "cs.ATG" 
				newType.StartLocation = t.EndLocation; 
				EnumBody();
				if (la.kind == 10) {
					lexer.NextToken();
				}

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

#line  757 "cs.ATG" 
				if (partial) Error ("partial is not allowed for delegate types");
				DelegateDeclaration delegateDeclr = new DelegateDeclaration();
				                           delegateDeclr.StartLocation = t.Location;
				                           delegateDeclr.Modifier = m.Modifier;
				                           delegateDeclr.Attributes = attributes;
				                        
				if (
#line  763 "cs.ATG" 
NotVoidPointer()) {
					Expect(122);

#line  763 "cs.ATG" 
					delegateDeclr.ReturnType = new TypeReference("void", 0, null); 
				} else if (StartOf(8)) {
					Type(
#line  764 "cs.ATG" 
out type);

#line  764 "cs.ATG" 
					delegateDeclr.ReturnType = type; 
				} else SynErr(130);
				Expect(1);

#line  766 "cs.ATG" 
				delegateDeclr.Name = t.val; 
				Expect(18);
				if (StartOf(9)) {
					FormalParameterList(
#line  767 "cs.ATG" 
out p);

#line  767 "cs.ATG" 
					delegateDeclr.Parameters = p; 
				}
				Expect(19);
				Expect(10);

#line  769 "cs.ATG" 
				delegateDeclr.EndLocation = t.Location;
				compilationUnit.AddChild(delegateDeclr);
				
			}
		} else SynErr(131);
	}
 public override object Visit(DelegateDeclaration delegateDeclaration, object data)
 {
     VisitAttributes(delegateDeclaration.Attributes, data);
     VisitModifier(delegateDeclaration.Modifier);
     outputFormatter.PrintToken(Tokens.Delegate);
     outputFormatter.Space();
     Visit(delegateDeclaration.ReturnType, data);
     outputFormatter.Space();
     outputFormatter.PrintIdentifier(delegateDeclaration.Name);
     outputFormatter.PrintToken(Tokens.OpenParenthesis);
     AppendCommaSeparatedList(delegateDeclaration.Parameters);
     outputFormatter.PrintToken(Tokens.CloseParenthesis);
     outputFormatter.PrintToken(Tokens.Semicolon);
     outputFormatter.NewLine();
     return null;
 }