本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
}