本文整理汇总了C#中CodeCompletion.SymScope.AddReferencedAssembly方法的典型用法代码示例。如果您正苦于以下问题:C# SymScope.AddReferencedAssembly方法的具体用法?C# SymScope.AddReferencedAssembly怎么用?C# SymScope.AddReferencedAssembly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeCompletion.SymScope
的用法示例。
在下文中一共展示了SymScope.AddReferencedAssembly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: visit
public override void visit(program_module _program_module)
{
//Assembly _as = System.Reflection.Assembly.LoadFrom(get_assembly_path("mscorlib.dll",_program_module.file_name));
string path = get_assembly_path("mscorlib.dll",_program_module.file_name);
System.Reflection.Assembly _as = PascalABCCompiler.NetHelper.NetHelper.LoadAssembly(path);
List<string> namespaces = new List<string>();
PascalABCCompiler.NetHelper.NetHelper.init_namespaces(_as);
AssemblyDocCache.Load(_as,path);
namespaces.AddRange(PascalABCCompiler.NetHelper.NetHelper.GetNamespaces(_as));
//List<Scope> netScopes = new List<Scope>();
//PascalABCCompiler.NetHelper.NetScope ns=new PascalABCCompiler.NetHelper.NetScope(unl,_as,tcst);
cur_scope = new InterfaceUnitScope(new SymInfo("", SymbolKind.Namespace,"program"),null,unl);
// if (XmlDoc.LookupLocalizedXmlDocForUnitWithSources(_program_module.file_name) != null)
// {
// UnitDocCache.LoadWithSources(cur_scope,_program_module.file_name);
// this.add_doc_from_text = false;
// }
//add_standart_types_simple();
CodeCompletionController.comp_modules[_program_module.file_name] = this.converter;
Stack<Position> regions_stack = new Stack<Position>();
if (CodeCompletionController.comp.CompilerOptions.CurrentProject != null && CodeCompletionController.comp.CompilerOptions.CurrentProject.ContainsSourceFile(_program_module.file_name))
{
IReferenceInfo[] refs = CodeCompletionController.comp.CompilerOptions.CurrentProject.References;
if (_program_module.compiler_directives == null)
_program_module.compiler_directives = new List<PascalABCCompiler.SyntaxTree.compiler_directive>();
foreach (IReferenceInfo ri in refs)
{
_program_module.compiler_directives.Add
(new PascalABCCompiler.SyntaxTree.compiler_directive(new token_info("reference"),new token_info(ri.FullAssemblyName)));
}
}
if (_program_module.compiler_directives != null)
foreach (PascalABCCompiler.SyntaxTree.compiler_directive dir in _program_module.compiler_directives)
{
if (dir.Name.text.ToLower() == "reference")
{
try
{
//System.Reflection.Assembly assm = System.Reflection.Assembly.LoadFrom(get_assembly_path(dir.Directive.text,_program_module.file_name));
path = get_assembly_path(dir.Directive.text,_program_module.file_name);
System.Reflection.Assembly assm = PascalABCCompiler.NetHelper.NetHelper.LoadAssembly(path);
if (assm != null)
{
PascalABCCompiler.NetHelper.NetHelper.init_namespaces(assm);
AssemblyDocCache.Load(assm, path);
namespaces.AddRange(PascalABCCompiler.NetHelper.NetHelper.GetNamespaces(assm));
cur_scope.AddReferencedAssembly(assm);
}
}
catch (Exception e)
{
}
}
else
if (dir.Name.text.ToLower() == "region")
{
if (cur_scope.regions == null)
cur_scope.regions = new List<Position>();
regions_stack.Push(new Position(dir.source_context.begin_position.line_num,dir.source_context.begin_position.column_num,dir.source_context.end_position.line_num,dir.source_context.end_position.column_num,dir.source_context.FileName));
}
else if (dir.Name.text.ToLower() == "endregion")
{
if (regions_stack.Count > 0)
{
Position pos = regions_stack.Pop();
if (cur_scope.regions != null)
{
cur_scope.regions.Add(new Position(pos.end_line,pos.end_column,dir.source_context.end_position.line_num,dir.source_context.end_position.column_num,pos.file_name));
}
}
}
}
doc = new document(_program_module.file_name);
cur_scope.loc = get_location(_program_module);
entry_scope = cur_scope;
if (_program_module.program_name != null)
cur_scope.head_loc = get_location(_program_module.program_name);
Hashtable ns_cache = new Hashtable(StringComparer.CurrentCultureIgnoreCase);
bool has_system_unit = false;
if (_program_module.used_units != null)
{
cur_scope.uses_source_range = get_location(_program_module.used_units);
//foreach (unit_or_namespace s in _program_module.used_units.units)
for (int j = _program_module.used_units.units.Count - 1; j >= 0; j--)
{
unit_or_namespace s = _program_module.used_units.units[j];
try
{
string str = "";
for (int i = 0; i < s.name.idents.Count; i++)
{
str += s.name.idents[i].name;
NamespaceScope ns_scope = null;
if (i == 0)
//.........这里部分代码省略.........