本文整理汇总了C#中CodeCompletion.SymScope.AddUsedUnit方法的典型用法代码示例。如果您正苦于以下问题:C# SymScope.AddUsedUnit方法的具体用法?C# SymScope.AddUsedUnit怎么用?C# SymScope.AddUsedUnit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeCompletion.SymScope
的用法示例。
在下文中一共展示了SymScope.AddUsedUnit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: visit
public override void visit(implementation_node _implementation_node)
{
//throw new Exception("The method or operation is not implemented.");
SymScope tmp = cur_scope;
unl.clear();
cur_scope = new ImplementationUnitScope(new SymInfo("$implementation",SymbolKind.Namespace,"implementation"),cur_scope);
tmp.AddName("$implementation",cur_scope);
(tmp as InterfaceUnitScope).impl_scope = cur_scope as ImplementationUnitScope;
cur_scope.loc = get_location(_implementation_node);
if (_implementation_node.uses_modules != null)
{
(cur_scope as ImplementationUnitScope).uses_source_range = get_location(_implementation_node.uses_modules);
for (int j=_implementation_node.uses_modules.units.Count-1; j>=0;j--)
{
unit_or_namespace s =_implementation_node.uses_modules.units[j];
string str="";
for (int i = 0; i < s.name.idents.Count; i++)
{
str += s.name.idents[i].name;
NamespaceScope ns_scope = null;
NamespaceScope ns_scope2 = null;
if (i == 0)
{
if (PascalABCCompiler.NetHelper.NetHelper.IsNetNamespace(str))
{
ns_scope = new NamespaceScope(str);
cur_scope.AddName(str,ns_scope);
if (s.name.idents.Count == 1)
cur_scope.AddUsedUnit(ns_scope);
}
else if (PascalABCCompiler.NetHelper.NetHelper.IsType(str) && semantic_options.allow_import_types)
{
Type t = PascalABCCompiler.NetHelper.NetHelper.FindType(str);
cur_scope.AddUsedUnit( new NamespaceTypeScope(TypeTable.get_compiled_type(new SymInfo(t.Name, SymbolKind.Class,t.FullName),t)));
}
else
{
try
{
string unit_name = null;
string pcu_unit_name = FindPCUFileName(str);
if (s is uses_unit_in)
unit_name = (s as uses_unit_in).in_file.Value;
else
unit_name = CodeCompletionNameHelper.FindSourceFileName(str, System.IO.Path.GetDirectoryName(this.cur_unit_file_name));
if (pcu_unit_name != null && unit_name != null && string.Compare(System.IO.Path.GetDirectoryName(this.cur_unit_file_name),System.IO.Path.GetDirectoryName(pcu_unit_name),true)==0
&& string.Compare(System.IO.Path.GetDirectoryName(this.cur_unit_file_name),System.IO.Path.GetDirectoryName(unit_name),true) != 0)
unit_name = null;
if (unit_name != null)
{
DomConverter dc = CodeCompletionController.comp_modules[unit_name] as DomConverter;
if (dc == null /*|| CodeCompletionController.recomp_files[unit_name] != null*/)
{
dc = new CodeCompletionController().CompileAllIfNeed(unit_name, true);
}
if (dc.stv != null)
{
dc.stv.entry_scope.InitAssemblies();
cur_scope.AddUsedUnit(dc.stv.entry_scope);
cur_scope.AddName(str,dc.stv.entry_scope);
}
}
else
{
//unit_name = FindPCUFileName(str);
unit_name = pcu_unit_name;
if (unit_name != null)
{
IntellisensePCUReader pcu_rdr = new IntellisensePCUReader();
SymScope ss = pcu_rdr.GetUnit(unit_name);
UnitDocCache.Load(ss,unit_name);
cur_scope.AddUsedUnit(ss);
cur_scope.AddName(str,ss);
}
//unit_name = System.IO.Path.GetDirectoryName(_program_module.file_name)+"\\"+str+System.IO.Path.GetExtension(_program_module.file_name);
}
}
catch (Exception e)
{
}
}
}
if (i == s.name.idents.Count - 1 && i > 0 /*&& PascalABCCompiler.NetHelper.NetHelper.IsNetNamespace(str)*/)
cur_scope.AddUsedUnit(new NamespaceScope(str));
if (i < s.name.idents.Count - 1)
str += ".";
}
unl.AddElement(new PascalABCCompiler.TreeRealization.using_namespace(str));
}
}
impl_scope = cur_scope;
if (_implementation_node.implementation_definitions != null)
foreach (declaration decl in _implementation_node.implementation_definitions.defs)
{
try
{
decl.visit(this);
}
//.........这里部分代码省略.........