當前位置: 首頁>>代碼示例>>C#>>正文


C# ScriptingContext.GetNamespaces方法代碼示例

本文整理匯總了C#中Mono.Debugger.Frontend.ScriptingContext.GetNamespaces方法的典型用法代碼示例。如果您正苦於以下問題:C# ScriptingContext.GetNamespaces方法的具體用法?C# ScriptingContext.GetNamespaces怎麽用?C# ScriptingContext.GetNamespaces使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mono.Debugger.Frontend.ScriptingContext的用法示例。


在下文中一共展示了ScriptingContext.GetNamespaces方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LookupType

        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;
        }
開發者ID:baulig,項目名稱:debugger,代碼行數:16,代碼來源:Expression.cs

示例2: Lookup

        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;
        }
開發者ID:baulig,項目名稱:debugger,代碼行數:19,代碼來源:Expression.cs

示例3: DoResolve

        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);
        }
開發者ID:baulig,項目名稱:debugger,代碼行數:45,代碼來源:Expression.cs

示例4: DoResolveType

        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;
        }
開發者ID:baulig,項目名稱:debugger,代碼行數:20,代碼來源:Expression.cs

示例5: SymbolCompleter

        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;
            }
        }
開發者ID:baulig,項目名稱:debugger,代碼行數:45,代碼來源:Completer.cs


注:本文中的Mono.Debugger.Frontend.ScriptingContext.GetNamespaces方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。