public void Write(MethodBody body) { SourceMethod meth = new SourceMethod(body.Method); SourceFile file; Instruction [] instructions = GetInstructions(body); int length = instructions.Length; if (length == 0) { return; } int [] offsets = new int [length]; int [] startRows = new int [length]; int [] startCols = new int [length]; int [] endRows = new int [length]; int [] endCols = new int [length]; Populate(instructions, offsets, startRows, startCols, endRows, endCols, out file); SourceMethodBuilder builder = m_writer.OpenMethod(file.CompilationUnit, 0, meth); for (int i = 0; i < length; i++) { builder.MarkSequencePoint(offsets [i], file.CompilationUnit.SourceFile, startRows [i], startCols [i], false); } MarkVariables(body); m_writer.CloseMethod(); }
public void Write(MethodBody body, /*Telerik Authorship*/ MetadataToken methodToken, /*Telerik Authorship*/ MetadataToken localVarToken) { var method = new SourceMethod (body.Method); var instructions = GetInstructions (body); int count = instructions.Count; if (count == 0) return; var offsets = new int [count]; var start_rows = new int [count]; var start_cols = new int [count]; SourceFile file; Populate (instructions, offsets, start_rows, start_cols, out file); var builder = writer.OpenMethod (file.CompilationUnit, 0, method); for (int i = 0; i < count; i++) builder.MarkSequencePoint ( offsets [i], file.CompilationUnit.SourceFile, start_rows [i], start_cols [i], false); if (body.HasVariables) AddVariables (body.Variables); writer.CloseMethod (); }
private static void Test() { var SourceType = typeof(TestCheckedExceptionWarning.Library.Foo); SourceType.GetMethods().WithEach( SourceMethod => { Console.WriteLine( new { SourceType, SourceMethod } ); SourceMethod.ToMethod().With( JVMMethod => { JVMMethod.getExceptionTypes().WithEach( c => { Console.WriteLine(" throws " + c.ToType().FullName); } ); } ); } ); }
/// <summary> /// </summary> /// <param name="function"> /// </param> /// <param name="generateFileOnly"> /// </param> private void ConvertFunction(PdbFunction function, bool generateFileOnly = false) { if (function.lines == null) { return; } var method = new SourceMethod { Token = (int)function.token, Name = function.name, LinkageName = function.name, DisplayName = function.name, LineNumber = function.lines.First().lines.First().lineBegin }; var file = this.GetSourceFile(this.symbolWriter, function); if (generateFileOnly) { return; } var builder = this.symbolWriter.OpenMethod(file.CompilationUnitEntry, method); this.ConvertSequencePoints(function, file, builder); this.ConvertVariables(function); this.symbolWriter.CloseMethod(); }
private void InsertRelationsBetweenMethods(SourceMethod methodFrom, SourceMethod methodTo) { methodFrom.AddMethodRelation(methodTo); methodTo.InvokedCount++; var nsFrom = methodFrom.ParentFile.Namespace; var nsTo = methodTo.ParentFile.Namespace; if (nsFrom != nsTo) { nsFrom.AddNamespaceRelation(nsTo); } }
void ConvertFunction (PdbFunction function) { var method = new SourceMethod { Name = function.name, Token = (int) function.token }; var file = GetSourceFile (mdb, function); var builder = mdb.OpenMethod (file.CompilationUnit, 0, method); ConvertSequencePoints (function, file, builder); ConvertVariables (function); mdb.CloseMethod (); }
public void Write(MethodBody body, /*Telerik Authorship*/ MetadataToken methodToken, /*Telerik Authorship*/ MetadataToken localVarToken) { var method = new SourceMethod(body.Method); var instructions = GetInstructions(body); int count = instructions.Count; if (count == 0) { return; } var offsets = new int [count]; var start_rows = new int [count]; var end_rows = new int [count]; var start_cols = new int [count]; var end_cols = new int [count]; SourceFile file; Populate(instructions, offsets, start_rows, end_rows, start_cols, end_cols, out file); var builder = writer.OpenMethod(file.CompilationUnit, 0, method); for (int i = 0; i < count; i++) { builder.MarkSequencePoint( offsets [i], file.CompilationUnit.SourceFile, start_rows [i], end_rows [i], start_cols [i], end_cols [i], false); } if (body.Scope != null && body.Scope.HasScopes) { WriteScope(body.Scope, true); } else if (body.HasVariables) { AddVariables(body.Variables); } writer.CloseMethod(); }
void ConvertFunction(PdbFunction function) { var method = new SourceMethod { Name = function.name, Token = (int)function.token }; var file = GetSourceFile(mdb, function); var builder = mdb.OpenMethod(file.CompilationUnit, 0, method); ConvertSequencePoints(function, file, builder); ConvertVariables(function); mdb.CloseMethod(); }
public static SourceAnalysisModel CreateAnalysisMock() { var model = new SourceAnalysisModel(); var ns1 = new SourceNamespace { FullName = "ns1" }; var ns2 = new SourceNamespace { FullName = "ns2" }; var f1 = new SourceFile { Filename = "filename1", Size = 200L, Namespace = ns1 }; var f2 = new SourceFile { Filename = "filename2", Size = 300L, Namespace = ns2 }; var m1 = new SourceMethod { Name = "method1", ParentFile = f1 }; var m2 = new SourceMethod { Name = "method2", ParentFile = f2 }; var r1 = new SourceRelation <SourceFile>(); r1.Reference = f2; r1.ReferencesCount = 3; SourceRelation <SourceFile>[] relations = { r1 }; // f1.FileRelationsByClassReferences = relations.ToList(); SourceFile[] files1 = { f1 }; ns1.Files = files1.ToList(); SourceFile[] files2 = { f2 }; ns2.Files = files2.ToList(); SourceFile[] files3 = { f1, f2 }; // model.Files = files3.ToList(); return(model); }
public void Write(MethodDebugInformation info) { var method = new SourceMethod(info.method); var sequence_points = info.SequencePoints; int count = sequence_points.Count; if (count == 0) { return; } var offsets = new int [count]; var start_rows = new int [count]; var end_rows = new int [count]; var start_cols = new int [count]; var end_cols = new int [count]; SourceFile file; Populate(sequence_points, offsets, start_rows, end_rows, start_cols, end_cols, out file); var builder = writer.OpenMethod(file.CompilationUnit, 0, method); for (int i = 0; i < count; i++) { builder.MarkSequencePoint( offsets [i], file.CompilationUnit.SourceFile, start_rows [i], start_cols [i], end_rows [i], end_cols [i], false); } if (info.scope != null) { WriteRootScope(info.scope, info); } writer.CloseMethod(); }
public void Write(MethodBody body) { var method = new SourceMethod(body.Method); var instructions = GetInstructions(body); int count = instructions.Count; if (count == 0) { return; } var offsets = new int [count]; var start_rows = new int [count]; var start_cols = new int [count]; SourceFile file; Populate(instructions, offsets, start_rows, start_cols, out file); var builder = writer.OpenMethod(file.CompilationUnit, 0, method); for (int i = 0; i < count; i++) { builder.MarkSequencePoint( offsets [i], file.CompilationUnit.SourceFile, start_rows [i], start_cols [i], false); } if (body.HasVariables) { AddVariables(body.Variables); } writer.CloseMethod(); }
public void Write(MethodBody body) { var method = new SourceMethod (body.Method); var instructions = GetInstructions (body); int count = instructions.Count; if (count == 0) return; var offsets = new int [count]; var start_rows = new int [count]; var end_rows = new int [count]; var start_cols = new int [count]; var end_cols = new int [count]; SourceFile file; Populate (instructions, offsets, start_rows, end_rows, start_cols, end_cols, out file); var builder = writer.OpenMethod (file.CompilationUnit, 0, method); for (int i = 0; i < count; i++) { builder.MarkSequencePoint ( offsets [i], file.CompilationUnit.SourceFile, start_rows [i], start_cols [i], end_rows [i], end_cols [i], false); } if (body.Scope != null && body.Scope.HasScopes) WriteScope (body.Scope, true); else if (body.HasVariables) AddVariables (body.Variables); writer.CloseMethod (); }
public void Write(MethodDebugInformation info) { var method = new SourceMethod (info.method); var sequence_points = info.SequencePoints; int count = sequence_points.Count; if (count == 0) return; var offsets = new int [count]; var start_rows = new int [count]; var end_rows = new int [count]; var start_cols = new int [count]; var end_cols = new int [count]; SourceFile file; Populate (sequence_points, offsets, start_rows, end_rows, start_cols, end_cols, out file); var builder = writer.OpenMethod (file.CompilationUnit, 0, method); for (int i = 0; i < count; i++) { builder.MarkSequencePoint ( offsets [i], file.CompilationUnit.SourceFile, start_rows [i], start_cols [i], end_rows [i], end_cols [i], false); } if (info.scope != null) WriteRootScope (info.scope, info); writer.CloseMethod (); }
public void Write (MethodBody body) { SourceMethod meth = new SourceMethod (body.Method); SourceFile file; Instruction [] instructions = GetInstructions (body); int length = instructions.Length; if (length == 0) return; int [] offsets = new int [length]; int [] startRows = new int [length]; int [] startCols = new int [length]; int [] endRows = new int [length]; int [] endCols = new int [length]; Populate (instructions, offsets, startRows, startCols, endRows, endCols, out file); SourceMethodBuilder builder = m_writer.OpenMethod (file.CompilationUnit, 0, meth); for (int i = 0; i < length; i++) builder.MarkSequencePoint (offsets [i], file.CompilationUnit.SourceFile, startRows [i], startCols [i], false); MarkVariables (body); m_writer.CloseMethod (); }
/// <summary> /// </summary> /// <param name="function"> /// </param> /// <param name="generateFileOnly"> /// </param> private void ConvertFunction(PdbFunction function, bool generateFileOnly = false) { if (function.lines == null) { return; } var method = new SourceMethod { Token = (int)function.token, Name = function.name, LinkageName = function.name, DisplayName = function.name, LineNumber = function.lines.First().lines.First().lineBegin }; var file = this.GetSourceFile(this.symbolWriter, function); if (generateFileOnly) { return; } var builder = this.symbolWriter.OpenMethod(file.CompilationUnitEntry, method); this.ConvertSequencePoints(function, file, builder); this.ConvertVariables(function); this.symbolWriter.CloseMethod(); }