Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2013-03-25 18:11:50 +0400
committerMarek Safar <marek.safar@gmail.com>2013-03-25 18:11:50 +0400
commit694f00b66fe642268f5c38443071d0acc08f1b44 (patch)
tree578463115730c7d182334aca09f8e1d1de935907 /mcs
parentf94c224b85b702bae48d4ef1422defb2d7049d52 (diff)
Don't capture any variables when block yield only breaks
Diffstat (limited to 'mcs')
-rw-r--r--mcs/mcs/cs-parser.jay2
-rw-r--r--mcs/mcs/statement.cs10
-rw-r--r--mcs/tests/ver-il-net_4_5.xml8
3 files changed, 13 insertions, 7 deletions
diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay
index fbd3c2086f8..902690017e9 100644
--- a/mcs/mcs/cs-parser.jay
+++ b/mcs/mcs/cs-parser.jay
@@ -5857,7 +5857,7 @@ yield_statement
FeatureIsNotAvailable (lt.Location, "iterators");
}
- current_block.Explicit.RegisterIteratorYield ();
+ current_block.ParametersBlock.TopBlock.IsIterator = true;
$$ = new YieldBreak (lt.Location);
lbag.AddStatement ($$, GetLocation ($2), GetLocation ($3));
}
diff --git a/mcs/mcs/statement.cs b/mcs/mcs/statement.cs
index eec04bb687b..6a8f29a6d2a 100644
--- a/mcs/mcs/statement.cs
+++ b/mcs/mcs/statement.cs
@@ -2059,7 +2059,8 @@ namespace Mono.CSharp {
HasAsyncModifier = 1 << 10,
Resolved = 1 << 11,
YieldBlock = 1 << 12,
- AwaitBlock = 1 << 13
+ AwaitBlock = 1 << 13,
+ Iterator = 1 << 14
}
public Block Parent;
@@ -2664,6 +2665,8 @@ namespace Mono.CSharp {
public void RegisterIteratorYield ()
{
+ ParametersBlock.TopBlock.IsIterator = true;
+
var block = this;
while ((block.flags & Flags.YieldBlock) == 0) {
block.flags |= Flags.YieldBlock;
@@ -3207,7 +3210,10 @@ namespace Mono.CSharp {
public bool IsIterator {
get {
- return HasYield;
+ return (flags & Flags.Iterator) != 0;
+ }
+ set {
+ flags = value ? flags | Flags.Iterator : flags & ~Flags.Iterator;
}
}
diff --git a/mcs/tests/ver-il-net_4_5.xml b/mcs/tests/ver-il-net_4_5.xml
index b41bd8cf779..d0f29b72b54 100644
--- a/mcs/tests/ver-il-net_4_5.xml
+++ b/mcs/tests/ver-il-net_4_5.xml
@@ -60574,7 +60574,7 @@
<size>26</size>
</method>
<method name="Boolean MoveNext()" attrs="486">
- <size>75</size>
+ <size>60</size>
</method>
<method name="Void Dispose()" attrs="486">
<size>1</size>
@@ -61208,7 +61208,7 @@
<size>26</size>
</method>
<method name="Boolean MoveNext()" attrs="486">
- <size>37</size>
+ <size>32</size>
</method>
<method name="Void Dispose()" attrs="486">
<size>1</size>
@@ -61234,7 +61234,7 @@
<size>26</size>
</method>
<method name="Boolean MoveNext()" attrs="486">
- <size>37</size>
+ <size>32</size>
</method>
<method name="Void Dispose()" attrs="486">
<size>1</size>
@@ -61260,7 +61260,7 @@
<size>26</size>
</method>
<method name="Boolean MoveNext()" attrs="486">
- <size>37</size>
+ <size>32</size>
</method>
<method name="Void Dispose()" attrs="486">
<size>1</size>