本文整理汇总了C#中CodeCompletion.SymScope类的典型用法代码示例。如果您正苦于以下问题:C# SymScope类的具体用法?C# SymScope怎么用?C# SymScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SymScope类属于CodeCompletion命名空间,在下文中一共展示了SymScope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUnit
public SymScope GetUnit(string FileName)
{
try
{
root_scope = unit_cache[FileName] as SymScope;
if (root_scope != null) return root_scope;
unit_name = System.IO.Path.GetFileNameWithoutExtension(FileName);
this.readDebugInfo = true;
this.FileName = FileName;
if (!File.Exists(FileName)) return null;
dir = System.IO.Path.GetDirectoryName(FileName);
fs = new FileStream(FileName, FileMode.Open, FileAccess.Read);
br = new BinaryReader(fs);
ReadPCUHeader();
root_scope = new InterfaceUnitScope(new SymInfo(unit_name, SymbolKind.Namespace,unit_name),null);
unit_cache[FileName] = root_scope;
cur_scope = root_scope;
AddReferencedAssemblies();
ReadInterfacePart();
fs.Close();
}
catch (Exception e)
{
fs.Close();
return root_scope;
}
return root_scope;
}
示例2: GetName
/// <summary>
/// Получение имен после точки
/// </summary>
public SymInfo[] GetName(expression expr, string str, int line, int col, PascalABCCompiler.Parsers.KeywordKind keyword, ref SymScope root)
{
if (visitor.cur_scope == null) return null;
if (col + 1 > str.Length)
col -= str.Length;
SymScope si = visitor.FindScopeByLocation(line + 1, col + 1);//stv.cur_scope;
if (si == null)
{
si = visitor.FindScopeByLocation(line, col + 1);
if (si == null)
return null;
}
SetCurrentUsedAssemblies();
ExpressionVisitor ev = new ExpressionVisitor(expr, si, visitor);
si = ev.GetScopeOfExpression(true, false);
root = si;
if (si is ElementScope) root = (si as ElementScope).sc;
else if (si is ProcScope) root = (si as ProcScope).return_type;
if (si != null)
{
if (!(si is TypeScope) && !(si is NamespaceScope))
{
SymInfo[] syms = si.GetNamesAsInObject(ev);
SymInfo[] ext_syms = null;
if (si is ElementScope)
ext_syms = visitor.cur_scope.GetSymInfosForExtensionMethods((si as ElementScope).sc as TypeScope);
List<SymInfo> lst = new List<SymInfo>();
lst.AddRange(syms);
if (ext_syms != null)
lst.AddRange(ext_syms);
RestoreCurrentUsedAssemblies();
List<SymInfo> lst_to_remove = new List<SymInfo>();
foreach (SymInfo si2 in lst)
if (si2.name.StartsWith("operator"))
lst_to_remove.Add(si2);
foreach (SymInfo si2 in lst_to_remove)
lst.Remove(si2);
return lst.ToArray();
}
else
{
if (si is TypeScope)
{
RestoreCurrentUsedAssemblies();
return (si as TypeScope).GetNames(ev, keyword, false);
}
else
{
if (ev.entry_scope.InUsesRange(line + 1, col + 1))
keyword = PascalABCCompiler.Parsers.KeywordKind.Uses;
RestoreCurrentUsedAssemblies();
return (si as NamespaceScope).GetNames(ev, keyword);
}
}
}
RestoreCurrentUsedAssemblies();
return null;
}
示例3: ComboBoxItem
public ComboBoxItem(SymScope item, string text, int iconIndex, bool isInCurrentPart, bool is_global)
{
this.item = item;
if (item != null)
pos = item.GetPosition();
this.text = text;
this.iconIndex = iconIndex;
this.isInCurrentPart = true;
this.is_global = is_global;
}
示例4: LoadWithSources
public static void LoadWithSources(SymScope unit, string fileName)
{
if (ht[unit] != null) return;
string xml_loc = CodeCompletionTools.XmlDoc.LookupLocalizedXmlDocForUnitWithSources(fileName, CodeCompletionController.currentLanguageISO);
if (xml_loc != null)
{
CodeCompletionTools.XmlDoc xdoc = CodeCompletionTools.XmlDoc.Load(xml_loc, Environment.GetEnvironmentVariable("TEMP"), false);
ht[unit] = xdoc;
}
}
示例5: GetScopeOfExpression
public SymScope GetScopeOfExpression(bool by_dot, bool on_bracket)
{
if (expr is const_node && !(expr is string_const) && !(expr is char_const) && !(expr is bool_const))
return null;
this.on_bracket = on_bracket;
try
{
expr.visit(this);
}
catch (Exception e)
{
returned_scope = null;
}
if (returned_scope != null && returned_scope is ElementScope && (returned_scope as ElementScope).sc is ProcType)
{
if (by_dot)
if (((returned_scope as ElementScope).sc as ProcType).target.return_type != null)
returned_scope = new ElementScope(((returned_scope as ElementScope).sc as ProcType).target.return_type);
else
returned_scope = null;
}
else if (returned_scope != null && returned_scope is ElementScope && (returned_scope as ElementScope).sc is ProcScope)
{
ProcScope ps = (returned_scope as ElementScope).sc as ProcScope;
TypeScope return_type = ps.return_type;
if (ps.is_constructor)
return_type = ps.declaringType;
if (by_dot)
if (return_type != null)
returned_scope = new ElementScope(return_type);
else
returned_scope = null;
}
else if (returned_scope != null && returned_scope is ElementScope && (returned_scope as ElementScope).sc is CompiledScope && ((returned_scope as ElementScope).sc as CompiledScope).CompiledType.BaseType == typeof(MulticastDelegate))
{
ProcScope invoke_meth = ((returned_scope as ElementScope).sc as CompiledScope).FindNameOnlyInThisType("Invoke") as ProcScope;
if (invoke_meth != null)
returned_scope = new ElementScope(invoke_meth.return_type);
}
else if (returned_scope != null && returned_scope is ProcScope)
{
ProcScope ps = returned_scope as ProcScope;
TypeScope return_type = ps.return_type;
if (ps.is_constructor)
return_type = ps.declaringType;
if (return_type == null)
{
if (by_dot) returned_scope = null;
}
else if (by_dot)
returned_scope = new ElementScope(return_type);
}
return returned_scope;
}
示例6: GetScopeOfExpression
public SymScope GetScopeOfExpression()
{
if (expr is const_node && !(expr is string_const) && !(expr is char_const) && !(expr is bool_const))
return null;
if (mouse_hover && (expr is typeof_operator || expr is sizeof_operator))
return null;
try
{
expr.visit(this);
}
catch(Exception e)
{
returned_scope = null;
}
if (returned_scope != null && returned_scope is ElementScope && (returned_scope as ElementScope).sc is ProcScope)
{
if ((returned_scope as ElementScope).si.kind == SymbolKind.Delegate)
returned_scope = (returned_scope as ElementScope).sc;
}
//else ret_scope = (ret_scope as ElementScope).sc as ProcScope;
return returned_scope;
}
示例7: BlockScope
public BlockScope(SymScope topScope)
{
this.topScope = topScope;
this.si = new SymInfo("$block_scope", SymbolKind.Block, "$block_scope");
this.members = new List<SymScope>();
}
示例8: AddName
public override void AddName(string name, SymScope sc)
{
if (members == null) members = new List<SymScope>();
base.AddName(name, sc);
}
示例9: AddUsedUnit
public void AddUsedUnit(SymScope unit)
{
used_units.Add(unit);
}
示例10: AddDescribeToComplete
public static void AddDescribeToComplete(SymScope value)
{
if (value is TypeScope) AddDescribeToComplete(value as TypeScope);
else if (value is ProcScope) AddDescribeToComplete(value as ProcScope);
else if (value is ElementScope) AddDescribeToComplete(value as ElementScope);
else if (value is InterfaceUnitScope) AddDescribeToComplete(value as InterfaceUnitScope);
}
示例11: IsEqual
public override bool IsEqual(SymScope ts)
{
if (ts is CompiledEventScope && (ts as CompiledEventScope).ei == this.ei) return true;
return false;
}
示例12: InterfaceUnitScope
public InterfaceUnitScope(SymInfo si, SymScope topScope)
: base(si, topScope)
{
UnitDocCache.AddDescribeToComplete(this);
this.symbol_table = new Hashtable(StringComparer.CurrentCultureIgnoreCase);
si.description = this.ToString();
}
示例13: IsChildScopeOf
public virtual bool IsChildScopeOf(SymScope ss)
{
return false;
}
示例14: GetClassMembers
void GetClassMembers(SymScope ss, ArrayList items)
{
if (ss != null && ss.members != null)
{
ArrayList meths = new ArrayList();
ArrayList fields = new ArrayList();
ArrayList events = new ArrayList();
ArrayList vars = new ArrayList();
ArrayList props = new ArrayList();
ArrayList consts = new ArrayList();
foreach (SymScope el in ss.members)
//if (el.si.kind == SymbolKind.Method || el.si.kind == SymbolKind.Constant || el.si.kind == SymbolKind.Variable || el.si.kind == SymbolKind.Event || el.si.kind == SymbolKind.Field
//|| el.si.kind == SymbolKind.Property)
if (el.GetPosition().file_name != null)
{
ComboBoxItem cbi = new ComboBoxItem(el, el.GetDescriptionWithoutDoc(), CodeCompletionProvider.ImagesProvider.GetPictureNum(el.si), true, false);
switch (el.si.kind)
{
case SymbolKind.Method: meths.Add(cbi); break;
case SymbolKind.Field: fields.Add(cbi); break;
case SymbolKind.Property: props.Add(cbi); break;
case SymbolKind.Variable: vars.Add(cbi); break;
case SymbolKind.Event: events.Add(cbi); break;
case SymbolKind.Constant: consts.Add(cbi); break;
}
//items.Add(new ComboBoxItem(el,el.GetDescriptionWithoutDoc(),CodeCompletionProvider.ImagesProvider.GetPictureNum(el.si),true));
}
meths.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture));
items.AddRange(meths);
props.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture));
items.AddRange(props);
fields.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture));
items.AddRange(fields);
vars.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture));
items.AddRange(vars);
consts.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture));
items.AddRange(consts);
events.Sort(new Comparer(System.Globalization.CultureInfo.InvariantCulture));
items.AddRange(events);
}
}
示例15: WithScope
public WithScope(SymScope topScope)
{
this.topScope = topScope;
this.si = new SymInfo("$with_block", SymbolKind.Block, "$with_block");
}