本文整理汇总了C#中Mono.CompilerServices.SymbolWriter.CompileUnitEntry类的典型用法代码示例。如果您正苦于以下问题:C# CompileUnitEntry类的具体用法?C# CompileUnitEntry怎么用?C# CompileUnitEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompileUnitEntry类属于Mono.CompilerServices.SymbolWriter命名空间,在下文中一共展示了CompileUnitEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SourceMethod
public SourceMethod (CompileUnitEntry file, MethodDef method, Location start)
{
this.file = file;
this.method = method;
this.StartLine = start.line;
lines = new ArrayList ();
MarkLocation (start.line, 0);
}
示例2: MethodEntry
internal MethodEntry(MonoSymbolFile file, CompileUnitEntry comp_unit, int token, ScopeVariable[] scope_vars, LocalVariableEntry[] locals, LineNumberEntry[] lines, CodeBlockEntry[] code_blocks, string real_name, MethodEntry.Flags flags, int namespace_id)
{
this.SymbolFile = file;
this.real_name = real_name;
this.locals = locals;
this.code_blocks = code_blocks;
this.scope_vars = scope_vars;
this.flags = flags;
this.index = -1;
this.Token = token;
this.CompileUnitIndex = comp_unit.Index;
this.CompileUnit = comp_unit;
this.NamespaceID = namespace_id;
this.CheckLineNumberTable(lines);
this.lnt = new LineNumberTable(file, lines);
file.NumLineNumbers += lines.Length;
int num_locals = (locals != null) ? locals.Length : 0;
if (num_locals <= 32)
{
for (int i = 0; i < num_locals; i++)
{
string nm = locals[i].Name;
for (int j = i + 1; j < num_locals; j++)
{
if (locals[j].Name == nm)
{
flags |= MethodEntry.Flags.LocalNamesAmbiguous;
goto IL_108;
}
}
}
IL_108:;
}
else
{
Dictionary<string, LocalVariableEntry> local_names = new Dictionary<string, LocalVariableEntry>();
for (int k = 0; k < locals.Length; k++)
{
LocalVariableEntry local = locals[k];
if (local_names.ContainsKey(local.Name))
{
flags |= MethodEntry.Flags.LocalNamesAmbiguous;
break;
}
local_names.Add(local.Name, local);
}
}
}
示例3: MethodEntry
internal MethodEntry (MonoSymbolFile file, CompileUnitEntry comp_unit,
int token, ScopeVariable[] scope_vars,
LocalVariableEntry[] locals, LineNumberEntry[] lines,
CodeBlockEntry[] code_blocks, string real_name,
Flags flags, int namespace_id)
{
this.SymbolFile = file;
this.real_name = real_name;
this.locals = locals;
this.code_blocks = code_blocks;
this.scope_vars = scope_vars;
this.flags = flags;
index = -1;
Token = token;
CompileUnitIndex = comp_unit.Index;
CompileUnit = comp_unit;
NamespaceID = namespace_id;
CheckLineNumberTable (lines);
lnt = new LineNumberTable (file, lines);
file.NumLineNumbers += lines.Length;
int num_locals = locals != null ? locals.Length : 0;
if (num_locals <= 32) {
// Most of the time, the O(n^2) factor is actually
// less than the cost of allocating the hash table,
// 32 is a rough number obtained through some testing.
for (int i = 0; i < num_locals; i ++) {
string nm = locals [i].Name;
for (int j = i + 1; j < num_locals; j ++) {
if (locals [j].Name == nm) {
flags |= Flags.LocalNamesAmbiguous;
goto locals_check_done;
}
}
}
locals_check_done :
;
} else {
Hashtable local_names = new Hashtable ();
foreach (LocalVariableEntry local in locals) {
if (local_names.Contains (local.Name)) {
flags |= Flags.LocalNamesAmbiguous;
break;
}
local_names.Add (local.Name, local);
}
}
}
示例4: SourceFile
public SourceFile(CompileUnitEntry comp_unit, SourceFileEntry entry)
{
this.compilation_unit = comp_unit;
this.entry = entry;
}
示例5: GetCompileUnit
public CompileUnitEntry GetCompileUnit (int index)
{
if ((index < 1) || (index > ot.CompileUnitCount))
throw new ArgumentException ();
if (reader == null)
throw new InvalidOperationException ();
lock (this) {
CompileUnitEntry unit;
if (compile_unit_hash.TryGetValue (index, out unit))
return unit;
long old_pos = reader.BaseStream.Position;
reader.BaseStream.Position = ot.CompileUnitTableOffset +
CompileUnitEntry.Size * (index - 1);
unit = new CompileUnitEntry (this, reader);
compile_unit_hash.Add (index, unit);
reader.BaseStream.Position = old_pos;
return unit;
}
}
示例6: DefineCompilationUnit
public CompileUnitEntry DefineCompilationUnit (SourceFileEntry source)
{
CompileUnitEntry entry = new CompileUnitEntry (file, source);
comp_units.Add (entry);
return entry;
}
示例7: GetCompileUnit
public CompileUnitEntry GetCompileUnit(int index)
{
if (index < 1 || index > this.ot.CompileUnitCount)
{
throw new ArgumentException();
}
if (this.reader == null)
{
throw new InvalidOperationException();
}
CompileUnitEntry result;
CompileUnitEntry unit;
if (this.compile_unit_hash.TryGetValue(index, out unit))
{
result = unit;
}
else
{
long old_pos = this.reader.BaseStream.Position;
this.reader.BaseStream.Position = (long)(this.ot.CompileUnitTableOffset + CompileUnitEntry.Size * (index - 1));
unit = new CompileUnitEntry(this, this.reader);
this.compile_unit_hash.Add(index, unit);
this.reader.BaseStream.Position = old_pos;
result = unit;
}
return result;
}
示例8: CheckCompileUnit
protected void CheckCompileUnit(CompileUnitEntry unit)
{
SourceFileEntry file = unit.SourceFile;
SourceFileEntry file2 = File.GetSourceFile (file.Index);
if ((file2 == null) || (file != file2))
throw new MonoSymbolFileException (
"Invalid source file reference in compile unit {0}.", unit.Index);
Debug (" Compile unit {0}: {1} {2} {3}", unit.Index, file, file2, file == file2);
if (unit.Namespaces == null)
throw new MonoSymbolFileException (
"Invalid name space table in compile unit {0}.", unit.Index);
}
示例9: CreateUnitSymbolInfo
//
// Creates symbol file index in debug symbol file
//
void CreateUnitSymbolInfo (MonoSymbolFile symwriter, List<KeyValuePair<string, string>> pathMap)
{
var si = file.CreateSymbolInfo (symwriter, pathMap);
comp_unit = new CompileUnitEntry (symwriter, si);
if (include_files != null) {
foreach (SourceFile include in include_files.Values) {
si = include.CreateSymbolInfo (symwriter, pathMap);
comp_unit.AddFile (si);
}
}
}
示例10: AddCompileUnit
internal int AddCompileUnit (CompileUnitEntry entry)
{
comp_units.Add (entry);
return comp_units.Count;
}
示例11: DefineMethod
public MethodEntry DefineMethod (CompileUnitEntry comp_unit, int token,
ScopeVariable[] scope_vars, LocalVariableEntry[] locals,
LineNumberEntry[] lines, CodeBlockEntry[] code_blocks,
string real_name, MethodEntry.Flags flags,
int namespace_id)
{
if (reader != null)
throw new InvalidOperationException ();
MethodEntry method = new MethodEntry (
this, comp_unit, token, scope_vars, locals, lines, code_blocks,
real_name, flags, namespace_id);
AddMethod (method);
return method;
}
示例12: DefineNamespace
public int DefineNamespace (string name, CompileUnitEntry unit,
string[] using_clauses, int parent)
{
if ((unit == null) || (using_clauses == null))
throw new NullReferenceException ();
return unit.DefineNamespace (name, using_clauses, parent);
}
示例13: DefineNamespace
public static int DefineNamespace (string name, CompileUnitEntry source,
string[] using_clauses, int parent)
{
if (symwriter != null)
return symwriter.DefineNamespace (name, source, using_clauses, parent);
else
return -1;
}
示例14: SymbolDocumentWriterImpl
public SymbolDocumentWriterImpl (CompileUnitEntry comp_unit)
{
this.comp_unit = comp_unit;
}
示例15: CreateUnitSymbolInfo
//
// Creates symbol file index in debug symbol file
//
void CreateUnitSymbolInfo(MonoSymbolFile symwriter)
{
var si = file.CreateSymbolInfo (symwriter);
comp_unit = new CompileUnitEntry (symwriter, si);
if (include_files != null) {
foreach (SourceFile include in include_files.Values) {
si = include.CreateSymbolInfo (symwriter);
comp_unit.AddFile (si);
}
}
}