~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonStandardModuleMethodResolveResult.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using ICSharpCode.SharpDevelop.Dom;
 
6
 
 
7
namespace ICSharpCode.PythonBinding
 
8
{
 
9
        public class PythonStandardModuleMethodGroupResolveResult : MethodGroupResolveResult
 
10
        {
 
11
                public PythonStandardModuleMethodGroupResolveResult(IReturnType containingType, string methodName, MethodGroup[] methodGroups)
 
12
                        : base(null, null, containingType, methodName, methodGroups)
 
13
                {
 
14
                }
 
15
                
 
16
                public static PythonStandardModuleMethodGroupResolveResult Create(PythonStandardModuleType type, string methodName)
 
17
                {
 
18
                        PythonModuleCompletionItems completionItems = PythonModuleCompletionItemsFactory.Create(type);
 
19
                        MethodGroup methods = completionItems.GetMethods(methodName);
 
20
                        if (methods.Count > 0) {
 
21
                                return Create(methods);
 
22
                        }
 
23
                        return null;
 
24
                }
 
25
                
 
26
                static PythonStandardModuleMethodGroupResolveResult Create(MethodGroup methods)
 
27
                {
 
28
                        MethodGroup[] methodGroups = new MethodGroup[] { methods };
 
29
                        IMethod method = methods[0];
 
30
                        IReturnType returnType = new DefaultReturnType(method.DeclaringType);
 
31
                        return new PythonStandardModuleMethodGroupResolveResult(returnType, method.Name, methodGroups);
 
32
                }
 
33
        }
 
34
}