本文整理汇总了C#中Mono.CSharp.DeclSpace.LookupNamespaceOrType方法的典型用法代码示例。如果您正苦于以下问题:C# DeclSpace.LookupNamespaceOrType方法的具体用法?C# DeclSpace.LookupNamespaceOrType怎么用?C# DeclSpace.LookupNamespaceOrType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.DeclSpace
的用法示例。
在下文中一共展示了DeclSpace.LookupNamespaceOrType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindDocumentedTypeNonArray
private static TypeSpec FindDocumentedTypeNonArray(MemberCore mc,
string identifier, DeclSpace ds, string cref, Report r)
{
switch (identifier) {
case "int":
return TypeManager.int32_type;
case "uint":
return TypeManager.uint32_type;
case "short":
return TypeManager.short_type;;
case "ushort":
return TypeManager.ushort_type;
case "long":
return TypeManager.int64_type;
case "ulong":
return TypeManager.uint64_type;;
case "float":
return TypeManager.float_type;;
case "double":
return TypeManager.double_type;
case "char":
return TypeManager.char_type;;
case "decimal":
return TypeManager.decimal_type;;
case "byte":
return TypeManager.byte_type;;
case "sbyte":
return TypeManager.sbyte_type;;
case "object":
return TypeManager.object_type;;
case "bool":
return TypeManager.bool_type;;
case "string":
return TypeManager.string_type;;
case "void":
return TypeManager.void_type;;
}
FullNamedExpression e = ds.LookupNamespaceOrType (identifier, 0, mc.Location, false);
if (e != null) {
if (!(e is TypeExpr))
return null;
return e.Type;
}
int index = identifier.LastIndexOf ('.');
if (index < 0)
return null;
int warn;
TypeSpec parent = FindDocumentedType (mc, identifier.Substring (0, index), ds, cref, r);
if (parent == null)
return null;
// no need to detect warning 419 here
var ts = FindDocumentedMember (mc, parent,
identifier.Substring (index + 1),
null, ds, out warn, cref, false, null, r) as TypeSpec;
if (ts != null)
return ts;
return null;
}
示例2: FindDocumentedTypeNonArray
private static TypeSpec FindDocumentedTypeNonArray (MemberCore mc,
string identifier, DeclSpace ds, string cref, Report r)
{
var types = mc.Module.Compiler.BuiltinTypes;
switch (identifier) {
case "int":
return types.Int;
case "uint":
return types.UInt;
case "short":
return types.Short;
case "ushort":
return types.UShort;
case "long":
return types.Long;
case "ulong":
return types.ULong;
case "float":
return types.Float;
case "double":
return types.Double;
case "char":
return types.Char;
case "decimal":
return types.Decimal;
case "byte":
return types.Byte;
case "sbyte":
return types.SByte;
case "object":
return types.Object;
case "bool":
return types.Bool;
case "string":
return types.String;
case "void":
return types.Void;
}
FullNamedExpression e = ds.LookupNamespaceOrType (identifier, 0, mc.Location, false);
if (e != null) {
if (!(e is TypeExpr))
return null;
return e.Type;
}
int index = identifier.LastIndexOf ('.');
if (index < 0)
return null;
var nsName = identifier.Substring (0, index);
var typeName = identifier.Substring (index + 1);
Namespace ns = ds.NamespaceEntry.NS.GetNamespace (nsName, false);
ns = ns ?? mc.Module.GlobalRootNamespace.GetNamespace(nsName, false);
if (ns != null) {
var te = ns.LookupType(mc, typeName, 0, true, mc.Location);
if(te != null)
return te.Type;
}
int warn;
TypeSpec parent = FindDocumentedType (mc, identifier.Substring (0, index), ds, cref, r);
if (parent == null)
return null;
// no need to detect warning 419 here
var ts = FindDocumentedMember (mc, parent,
identifier.Substring (index + 1),
null, ds, out warn, cref, false, null, r) as TypeSpec;
if (ts != null)
return ts;
return null;
}