本文整理汇总了C#中CodeCompletion.TypeScope类的典型用法代码示例。如果您正苦于以下问题:C# TypeScope类的具体用法?C# TypeScope怎么用?C# TypeScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeScope类属于CodeCompletion命名空间,在下文中一共展示了TypeScope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FileScope
public FileScope(TypeScope elementType, SymScope topScope)
{
this.topScope = topScope;
if (topScope != null)
{
if (elementType != null)
this.baseScope = topScope.FindName("TypedFile") as TypeScope;
else
this.baseScope = topScope.FindName("BinaryFile") as TypeScope;
}
this.elementType = elementType;
this.si = new SymInfo(this.ToString(), SymbolKind.Type, this.ToString());
}
示例2: AddIndexer
public override void AddIndexer(TypeScope ts)
{
}
示例3: GetTypeName
private static string GetTypeName(TypeScope typ)
{
StringBuilder sb = new StringBuilder();
if (typ == null)
return "";
if (typ is CompiledScope)
sb.Append((typ as CompiledScope).ctn.FullName);
else if (typ is ArrayScope)
{
ArrayScope arr = typ as ArrayScope;
if (arr.is_dynamic_arr)
{
ArrayScope tmp = arr;
int j=1;
while (tmp.elementType is ArrayScope && (tmp.elementType as ArrayScope).is_dynamic_arr)
{
j++;
tmp = tmp.elementType as ArrayScope;
}
sb.Append(GetTypeName(tmp.elementType));
for (int k=0; k<j; k++)
sb.Append("[]");
}
else
{
sb.Append("@array[");
for (int j=0; j<arr.indexes.Length; j++)
{
sb.Append(GetTypeName(arr.indexes[j]));
if (j<arr.indexes.Length-1)
sb.Append(",");
}
sb.Append("]");
sb.Append("["+GetTypeName(arr.elementType)+"]");
}
}
else if (typ is ProcType)
{
sb.Append(GetDelegateName((typ as ProcType).target));
}
else if (typ is SetScope)
{
sb.Append("@set["+GetTypeName((typ as SetScope).elementType)+"]");
}
else if (typ is FileScope)
{
if (typ.elementType != null)
sb.Append("@fileof["+GetTypeName(typ.elementType)+"]");
else
sb.Append("@file");
}
else if (typ is TypeSynonim)
{
sb.Append(GetTypeName((typ as TypeSynonim).actType));
}
else if (typ is PointerScope)
{
PointerScope ptr = typ as PointerScope;
int j=1;
while (ptr.ref_type is PointerScope)
{
j++;
ptr = ptr.ref_type as PointerScope;
}
for (int k=0; k<j; k++)
sb.Append("*");
sb.Append(ptr.ref_type);
}
else if (typ is ShortStringScope)
{
sb.Append("@string["+(typ as ShortStringScope).Length+"]");
}
else if (typ is DiapasonScope)
{
sb.Append("@diap["+(typ as DiapasonScope).left+".."+(typ as DiapasonScope).right+"]");
}
else
sb.Append(typ.declaringUnit.si.name+"."+typ.si.name);
return sb.ToString();
}
示例4: AddImplementedInterface
public virtual void AddImplementedInterface(TypeScope type)
{
if (implemented_interfaces == null) implemented_interfaces = new List<TypeScope>();
implemented_interfaces.Add(type);
}
示例5: AddGenericInstanciation
public virtual void AddGenericInstanciation(TypeScope ts)
{
instances.Add(ts);
}
示例6: simpleGetInstance
protected virtual TypeScope simpleGetInstance(List<TypeScope> gen_args)
{
TypeScope ts = new TypeScope(this.kind, this.topScope, this.baseScope);
ts.original_type = this;
ts.loc = this.loc;
for (int i = 0; i < gen_args.Count; i++)
{
ts.AddGenericParameter(gen_args[i].si.name);
ts.AddGenericInstanciation(gen_args[i]);
}
ts.si.name = this.si.name;
ts.documentation = this.documentation;
ts.si.description = ts.GetDescription();
return ts;
}
示例7: IsConvertable
public override bool IsConvertable(TypeScope ts)
{
if (ts is TypeSynonim) return actType.IsConvertable((ts as TypeSynonim).actType);
if (ts is ShortStringScope) return true;
return false;
}
示例8: ArrayScope
public ArrayScope(TypeScope elementType, TypeScope[] indexes)
{
this.elementType = elementType;
this.indexes = indexes;
if (indexes == null)
is_dynamic_arr = true;
else
{
_is_multi_dyn_arr = true;
foreach (TypeScope ind_ts in indexes)
{
if (ind_ts != null)
{
_is_multi_dyn_arr = false;
break;
}
}
}
Type tarr = typeof(Array);
this.baseScope = TypeTable.get_compiled_type(new SymInfo(tarr.Name, SymbolKind.Type, tarr.FullName), tarr);
//if (is_dynamic_arr || _is_multi_dyn_arr)
{
List<TypeScope> lst = new List<TypeScope>();
lst.Add(elementType);
this.implemented_interfaces = new List<TypeScope>();
this.implemented_interfaces.Add(CompiledScope.get_type_instance(typeof(IEnumerable<>), lst));
}
this.si = new SymInfo("$" + this.ToString(), SymbolKind.Type, this.ToString());
this.members = new List<SymScope>();
}
示例9: TypeSynonim
public TypeSynonim(SymInfo si, SymScope actType)
: base(SymbolKind.Type, null, null)
{
this.actType = actType as TypeScope;
this.si = si;
if (actType.si != null && actType.si.description != null)
this.si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetDescription(this);
//this.si.describe = "type "+this.si.name + " = "+actType.si.name;
}
示例10: TemplateParameterScope
public TemplateParameterScope(string name, TypeScope baseType, SymScope declScope)
: base(SymbolKind.Type, null, baseType)
{
this.declScope = declScope;
this.topScope = declScope;
this.name = name;
si.description = name + " in " + declScope.si.name;
}
示例11: GetExtensionMethods
public List<ProcScope> GetExtensionMethods(TypeScope ts)
{
if (ts is ArrayScope && !(ts as ArrayScope).is_dynamic_arr)
return new List<ProcScope>();
List<ProcScope> lst = new List<ProcScope>();
List<ProcScope> meths = null;
TypeScope tmp_ts = ts;
if (extension_methods != null)
{
while (tmp_ts != null)
{
TypeScope tmp_ts2 = tmp_ts;
if (tmp_ts is CompiledScope && (tmp_ts as CompiledScope).CompiledType.IsGenericType && !(tmp_ts as CompiledScope).CompiledType.IsGenericTypeDefinition)
tmp_ts2 = TypeTable.get_compiled_type((tmp_ts as CompiledScope).CompiledType.GetGenericTypeDefinition());
if (extension_methods.TryGetValue(tmp_ts2, out meths))
{
lst.AddRange(meths);
}
else
{
foreach (TypeScope t in extension_methods.Keys)
{
if (t.GenericTypeDefinition == tmp_ts2.GenericTypeDefinition || t.IsEqual(tmp_ts2) || (t is ArrayScope && tmp_ts2.IsArray) || ( tmp_ts2 is ArrayScope && t.IsArray) || (t is TemplateParameterScope || t is UnknownScope))
{
lst.AddRange(extension_methods[t]);
}
}
}
tmp_ts = tmp_ts.baseScope;
}
if (ts.implemented_interfaces != null)
foreach (TypeScope int_ts in ts.implemented_interfaces)
{
TypeScope int_ts2 = int_ts;
if (int_ts is CompiledScope && (int_ts as CompiledScope).CompiledType.IsGenericType && !(int_ts as CompiledScope).CompiledType.IsGenericTypeDefinition)
int_ts2 = TypeTable.get_compiled_type((int_ts as CompiledScope).CompiledType.GetGenericTypeDefinition());
if (extension_methods.TryGetValue(int_ts2, out meths))
{
lst.AddRange(meths);
}
else
{
foreach (TypeScope t in extension_methods.Keys)
{
if (t.GenericTypeDefinition == int_ts2.GenericTypeDefinition || t.IsEqual(int_ts2) || (t is ArrayScope && int_ts2.IsArray) || (int_ts2 is ArrayScope && t.IsArray))
{
lst.AddRange(extension_methods[t]);
//break;
}
}
}
}
}
if (this.used_units != null)
for (int i = 0; i < this.used_units.Count; i++)
{
if (this.used_units[i] != this)
lst.AddRange(this.used_units[i].GetExtensionMethods(ts));
}
return lst;
}
示例12: AddExtensionMethod
public void AddExtensionMethod(string name, ProcScope meth, TypeScope ts)
{
if (extension_methods == null)
extension_methods = new Dictionary<TypeScope, List<ProcScope>>();
List<ProcScope> meth_list = null;
if (ts is CompiledScope && (ts as CompiledScope).CompiledType.IsGenericType && !(ts as CompiledScope).CompiledType.IsGenericTypeDefinition)
ts = TypeTable.get_compiled_type((ts as CompiledScope).CompiledType.GetGenericTypeDefinition());
if (ts.original_type != null)
ts = ts.original_type;
if (!extension_methods.TryGetValue(ts, out meth_list))
{
meth_list = new List<ProcScope>();
extension_methods.Add(ts, meth_list);
}
meth_list.Add(meth);
}
示例13: TypeScope
public TypeScope(SymbolKind kind, SymScope topScope, SymScope baseScope)
{
this.kind = kind;
this.baseScope = baseScope as TypeScope;
this.topScope = topScope;
if (baseScope == null)
{
if (CodeCompletionController.CurrentParser.LanguageInformation.IncludeDotNetEntities)
switch (kind)
{
case SymbolKind.Struct: this.baseScope = TypeTable.get_compiled_type(new SymInfo(typeof(ValueType).Name, SymbolKind.Struct, typeof(ValueType).FullName), typeof(ValueType)); break;
case SymbolKind.Interface:
case SymbolKind.Class: this.baseScope = TypeTable.get_compiled_type(new SymInfo(typeof(object).Name, SymbolKind.Class, typeof(object).FullName), typeof(object)); break;
case SymbolKind.Enum: this.baseScope = TypeTable.get_compiled_type(new SymInfo(typeof(Enum).Name, SymbolKind.Enum, typeof(Enum).FullName), typeof(Enum)); break;
}
}
//this.ht = new Hashtable(CaseInsensitiveHashCodeProvider.Default,CaseInsensitiveComparer.Default);
this.members = new List<SymScope>();
this.indexers = new List<TypeScope>();
this.instances = new List<TypeScope>();
//this.generic_params = new List<string>();
si = new SymInfo("type", kind, "type");
//UnitDocCache.AddDescribeToComplete(this);
switch (kind)
{
case SymbolKind.Struct: si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Struct); break;
case SymbolKind.Class: si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Class); break;
case SymbolKind.Interface: si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Interface); break;
case SymbolKind.Enum: si.description = CodeCompletionController.CurrentParser.LanguageInformation.GetKeyword(PascalABCCompiler.Parsers.SymbolKind.Enum); break;
}
}
示例14: internalInstance
private TypeScope internalInstance(TypeScope ts, List<TypeScope> gen_args)
{
if (ts is TemplateParameterScope || ts is UnknownScope)
{
int ind = this.generic_params.IndexOf(ts.Name);
if (ind != -1)
{
return gen_args[ind];
}
else
return ts;
}
else if (ts is ArrayScope)
{
ArrayScope arr = null;
if ((ts as ArrayScope).is_dynamic_arr)
{
arr = new ArrayScope(internalInstance(ts.elementType, gen_args), (ts as ArrayScope).indexes);
arr.is_dynamic_arr = true;
}
else
arr = new ArrayScope(internalInstance(ts.elementType, gen_args), (ts as ArrayScope).indexes);
return arr;
}
else if (ts is TypeScope && ts.instances != null && ts.instances.Count > 0)
{
return ts.simpleGetInstance(gen_args);
}
else
return ts;
}
示例15: GetSymInfosForExtensionMethods
public SymInfo[] GetSymInfosForExtensionMethods(TypeScope ts)
{
if (ts is ArrayScope && !(ts as ArrayScope).is_dynamic_arr)
return new SymInfo[0];
List<SymInfo> lst = new List<SymInfo>();
List<ProcScope> meth_list = GetExtensionMethods(ts);
for (int i = 0; i < meth_list.Count; i++)
lst.Add(meth_list[i].si);
return lst.ToArray();
}