diff options
author | Marek Safar <marek.safar@gmail.com> | 2016-01-29 22:22:04 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2016-01-29 22:24:20 +0300 |
commit | 8ad1f59aa86b449c03b0cbb1814d764036fa9b97 (patch) | |
tree | 57ca4e8f17ff7b27e6cb3ef17c58d1ba271b44ec /mcs/class/Mono.CompilerServices.SymbolWriter | |
parent | bf5947a0fd2b523c30833605ee69b2b041aa43f4 (diff) |
[mcs] Rework naming convention of lifted state machine fields to include scope index. Fixes #32315 (1st part)
Diffstat (limited to 'mcs/class/Mono.CompilerServices.SymbolWriter')
-rw-r--r-- | mcs/class/Mono.CompilerServices.SymbolWriter/SourceMethodBuilder.cs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/mcs/class/Mono.CompilerServices.SymbolWriter/SourceMethodBuilder.cs b/mcs/class/Mono.CompilerServices.SymbolWriter/SourceMethodBuilder.cs index bd801f657b1..89763f52ec9 100644 --- a/mcs/class/Mono.CompilerServices.SymbolWriter/SourceMethodBuilder.cs +++ b/mcs/class/Mono.CompilerServices.SymbolWriter/SourceMethodBuilder.cs @@ -28,6 +28,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +using System; using System.Collections.Generic; namespace Mono.CompilerServices.SymbolWriter @@ -90,6 +91,11 @@ namespace Mono.CompilerServices.SymbolWriter public void StartBlock (CodeBlockEntry.Type type, int start_offset) { + StartBlock (type, start_offset, _blocks == null ? 1 : _blocks.Count + 1); + } + + public void StartBlock (CodeBlockEntry.Type type, int start_offset, int scopeIndex) + { if (_block_stack == null) { _block_stack = new Stack<CodeBlockEntry> (); } @@ -100,7 +106,7 @@ namespace Mono.CompilerServices.SymbolWriter int parent = CurrentBlock != null ? CurrentBlock.Index : -1; CodeBlockEntry block = new CodeBlockEntry ( - _blocks.Count + 1, parent, type, start_offset); + scopeIndex, parent, type, start_offset); _block_stack.Push (block); _blocks.Add (block); @@ -180,9 +186,18 @@ namespace Mono.CompilerServices.SymbolWriter public void DefineMethod (MonoSymbolFile file, int token) { - MethodEntry entry = new MethodEntry ( + var blocks = Blocks; + + // + // When index is provided by user it can be inserted in + // any order but mdb format does not store its value. It + // uses store order instead as the index. + // + Array.Sort (blocks, (x, y) => x.Index.CompareTo (y.Index)); + + var entry = new MethodEntry ( file, _comp_unit.Entry, token, ScopeVariables, - Locals, method_lines.ToArray (), Blocks, null, MethodEntry.Flags.ColumnsInfoIncluded, ns_id); + Locals, method_lines.ToArray (), blocks, null, MethodEntry.Flags.ColumnsInfoIncluded, ns_id); file.AddMethod (entry); } |