private static IReturnType CreateReturnType(AST.TypeReference reference, IMethod method, IClass currentClass, ICompilationUnit cu)
 {
     if (currentClass == null)
     {
         return(TypeVisitor.CreateReturnType(reference, new DefaultClass(cu, "___DummyClass"), method, 1, 1, cu.ProjectContent, true));
     }
     else
     {
         return(TypeVisitor.CreateReturnType(reference, currentClass, method, currentClass.Region.BeginLine + 1, 1, cu.ProjectContent, true));
     }
 }
        private void CreateDelegate(DefaultClass c, string name, AST.TypeReference returnType, IList <AST.TemplateDefinition> templates, IList <AST.ParameterDeclarationExpression> parameters)
        {
            c.BaseTypes.Add(c.ProjectContent.SystemTypes.Delegate);
            if (_currentClass.Count > 0)
            {
                DefaultClass cur = GetCurrentClass();
                cur.InnerClasses.Add(c);
                c.FullyQualifiedName = cur.FullyQualifiedName + '.' + name;
            }
            else
            {
                if (_currentNamespace.Count == 0)
                {
                    c.FullyQualifiedName = name;
                }
                else
                {
                    c.FullyQualifiedName = _currentNamespace.Peek() + '.' + name;
                }
                _cu.Classes.Add(c);
            }
            _currentClass.Push(c); // necessary for CreateReturnType
            ConvertTemplates(templates, c);

            List <IParameter> p = new List <IParameter>();

            if (parameters != null)
            {
                foreach (AST.ParameterDeclarationExpression param in parameters)
                {
                    p.Add(CreateParameter(param));
                }
            }
            AnonymousMethodReturnType.AddDefaultDelegateMethod(c, CreateReturnType(returnType), p);

            _currentClass.Pop();
        }
 private IReturnType CreateReturnType(AST.TypeReference reference)
 {
     return(CreateReturnType(reference, null));
 }
 private IReturnType CreateReturnType(AST.TypeReference reference, IMethod method)
 {
     return(CreateReturnType(reference, method, GetCurrentClass(), _cu));
 }