public override void FlowAnalysis (FlowAnalysisContext fc)
{
- expr.FlowAnalysis (fc);
+ orig_expr.FlowAnalysis (fc);
+ }
+
+ public override void FlowAnalysisConditional (FlowAnalysisContext fc)
+ {
+ orig_expr.FlowAnalysisConditional (fc);
}
public override SLE.Expression MakeExpression (BuilderContext ctx)
}
//
- // It's ok to have variable builder create out of order. It simplified emit
+ // It's ok to have variable builder created out of order. It simplifies emit
// of statements like while (condition) { }
//
if (!Variable.Created)
--- /dev/null
+using System.Collections.Generic;
+
+class Expr
+{
+ public int Field;
+ public Expr Next;
+}
+
+static class X
+{
+ public static IEnumerable<int> Test (this Expr expr)
+ {
+ var exprCur = expr;
+ while (exprCur != null)
+ {
+ if (exprCur is Expr list)
+ {
+ yield return list.Field;
+ exprCur = list.Next;
+ }
+ else
+ {
+ yield return 2;
+ yield break;
+ }
+ }
+ }
+
+ public static void Main ()
+ {
+ }
+}
\ No newline at end of file
</method>
</type>
</test>
+ <test name="test-pattern-08.cs">
+ <type name="Expr">
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="X">
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test(Expr)" attrs="150">
+ <size>30</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ </type>
+ <type name="X+<Test>c__Iterator0">
+ <method name="Boolean MoveNext()" attrs="486">
+ <size>184</size>
+ </method>
+ <method name="Int32 System.Collections.Generic.IEnumerator<int>.get_Current()" attrs="2529">
+ <size>14</size>
+ </method>
+ <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
+ <size>19</size>
+ </method>
+ <method name="Void Dispose()" attrs="486">
+ <size>15</size>
+ </method>
+ <method name="Void Reset()" attrs="486">
+ <size>6</size>
+ </method>
+ <method name="System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
+ <size>14</size>
+ </method>
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">
+ <size>40</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-pragma-unrecognized.cs">
<type name="C">
<method name="Void Main()" attrs="150">