GetNamespaces() public method

public GetNamespaces ( ) : string[]
return string[]
コード例 #1
0
ファイル: Completer.cs プロジェクト: tralivali1234/debugger
        public string[] SymbolCompleter(ScriptingContext context, string text)
        {
            try {
                var      method_list = new List <string> ();
                string[] namespaces  = context.GetNamespaces();
                Module[] modules     = context.CurrentProcess.Modules;

                foreach (Module module in modules)
                {
                    if (!module.SymbolsLoaded || !module.SymbolTable.HasMethods)
                    {
                        continue;
                    }

                    SourceFile[] sources = module.Sources;
                    if (sources == null)
                    {
                        continue;
                    }

                    foreach (SourceFile sf in sources)
                    {
                        foreach (MethodSource method in sf.Methods)
                        {
                            if (method.Name.StartsWith(text))
                            {
                                int parameter_start = method.Name.IndexOf('(');
                                if (parameter_start != -1)
                                {
                                    method_list.Add(method.Name.Substring(0, parameter_start));
                                }
                                else
                                {
                                    method_list.Add(method.Name);
                                }
                            }
                            if (namespaces != null)
                            {
                                foreach (string n in namespaces)
                                {
                                    if (n != "" && method.Name.StartsWith(String.Concat(n, ".", text)))
                                    {
                                        int parameter_start = method.Name.IndexOf('(');
                                        if (parameter_start != -1)
                                        {
                                            method_list.Add(method.Name.Substring(n.Length + 1,
                                                                                  parameter_start - n.Length - 1));
                                        }
                                        else
                                        {
                                            method_list.Add(method.Name.Substring(n.Length + 1));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                return(method_list.ToArray());
            } catch {
                return(null);
            }
        }
コード例 #2
0
ファイル: Expression.cs プロジェクト: baulig/debugger
        TargetType LookupType(ScriptingContext context)
        {
            TargetType type = context.CurrentLanguage.LookupType (proxy_type);
            if (type != null)
                return type;

            string[] namespaces = context.GetNamespaces () ?? new string [0];
            foreach (string ns in namespaces) {
                string full_name = SimpleNameExpression.MakeFQN (ns, proxy_type);
                type = context.CurrentLanguage.LookupType (full_name);
                if (type != null)
                    return type;
            }

            return null;
        }
コード例 #3
0
ファイル: Expression.cs プロジェクト: baulig/debugger
        MemberExpression Lookup(ScriptingContext context, StackFrame frame)
        {
            MemberExpression member = LookupMember (context, frame, name);
            if (member != null)
                return member;

            string[] namespaces = context.GetNamespaces ();
            if (namespaces == null)
                return null;

            foreach (string ns in namespaces) {
                string full_name = MakeFQN (ns, name);
                member = LookupMember (context, frame, full_name);
                if (member != null)
                    return member;
            }

            return null;
        }
コード例 #4
0
ファイル: Expression.cs プロジェクト: baulig/debugger
        protected override Expression DoResolveType(ScriptingContext context)
        {
            Language language = context.CurrentLanguage;
            TargetType type = language.LookupType (name);
            if (type != null)
                return new TypeExpression (type);

            string[] namespaces = context.GetNamespaces ();
            if (namespaces == null)
                return null;

            foreach (string ns in namespaces) {
                string full_name = MakeFQN (ns, name);
                type = language.LookupType (full_name);
                if (type != null)
                    return new TypeExpression (type);
            }

            return null;
        }
コード例 #5
0
ファイル: Expression.cs プロジェクト: baulig/debugger
        protected override Expression DoResolve(ScriptingContext context)
        {
            if (context.HasFrame) {
                StackFrame frame = context.CurrentFrame;
                if ((frame.Method != null) && frame.Method.IsLoaded) {
                    TargetVariable var = GetVariableByName (frame, name);
                    if (var != null)
                        return new VariableAccessExpression (var);
                }

                Expression expr = Lookup (context, frame);
                if (expr != null)
                    return expr;

                TargetAddress address = context.CurrentProcess.LookupSymbol (name);
                if (!address.IsNull)
                    return new NumberExpression (address.Address);
            } else if (context.ImplicitInstance != null) {
                MemberExpression member = StructAccessExpression.FindMember (
                    context.CurrentThread, context.ImplicitInstance.Type,
                    context.ImplicitInstance, name, true, true);
                if (member != null)
                    return member;

                string[] namespaces = context.GetNamespaces () ?? new string [0];
                foreach (string ns in namespaces) {
                    string full_name = MakeFQN (ns, name);
                    member = StructAccessExpression.FindMember (
                        context.CurrentThread, context.ImplicitInstance.Type,
                        context.ImplicitInstance, full_name, true, true);
                    if (member != null)
                        return member;
                }
            }

            SourceLocation location = context.FindMethod (name);
            if (location != null)
                return new SourceExpression (location);

            Expression texpr = DoResolveType (context);
            if (texpr != null)
                return texpr;

            throw new ScriptingException ("No symbol `{0}' in current context.", Name);
        }
コード例 #6
0
ファイル: Completer.cs プロジェクト: baulig/debugger
        public string[] SymbolCompleter(ScriptingContext context, string text)
        {
            try {
                var method_list = new List<string> ();
                string[] namespaces = context.GetNamespaces();
                Module[] modules = context.CurrentProcess.Modules;

                foreach (Module module in modules) {
                    if (!module.SymbolsLoaded || !module.SymbolTable.HasMethods)
                        continue;

                    SourceFile[] sources = module.Sources;
                    if (sources == null)
                        continue;

                    foreach (SourceFile sf in sources) {
                        foreach (MethodSource method in sf.Methods) {
                            if (method.Name.StartsWith (text)) {
                                int parameter_start = method.Name.IndexOf ('(');
                                if (parameter_start != -1)
                                    method_list.Add (method.Name.Substring (0, parameter_start));
                                else
                                    method_list.Add (method.Name);
                            }
                            if (namespaces != null) {
                                foreach (string n in namespaces) {
                                    if (n != "" && method.Name.StartsWith (String.Concat (n, ".", text))) {
                                        int parameter_start = method.Name.IndexOf ('(');
                                        if (parameter_start != -1)
                                            method_list.Add (method.Name.Substring (n.Length + 1,
                                                                parameter_start - n.Length - 1));
                                        else
                                            method_list.Add (method.Name.Substring (n.Length + 1));
                                    }
                                }
                            }
                        }
                    }
                }

                return method_list.ToArray ();
            } catch {
                return null;
            }
        }